summaryrefslogtreecommitdiffstats
path: root/psresize2.pl
diff options
context:
space:
mode:
Diffstat (limited to 'psresize2.pl')
-rwxr-xr-xpsresize2.pl17
1 files changed, 7 insertions, 10 deletions
diff --git a/psresize2.pl b/psresize2.pl
index 67e9d4a..0a0910d 100755
--- a/psresize2.pl
+++ b/psresize2.pl
@@ -4,7 +4,6 @@
use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat
bundling auto_version auto_help);
use Pod::Usage;
-use IPC::Open2;
use IPC::Open3;
use POSIX qw(floor);
use strict;
@@ -238,7 +237,7 @@ if (defined $crop) {
# cat > $auxfile
while (<FIN>) {
- print FINAUX $_ or die "Can't print: $!";
+ print FINAUX or die "Can't print: $!";
}
close FINAUX or die "Can't close: $!";
close FIN or die "Can't close: $!";
@@ -293,12 +292,10 @@ if (defined $crop) {
# in background, once the Bounding Box has been read
pipe *READ, *WRITE or die "Can't pipe: $!";
- while (<FIN>) {
- print WRITE $_;
- if ($_ =~ m/^\%\%BoundingBox: (\d+) (\d+) (\d+) (\d+)/) {
- @bbox = ($1, $2, $3, $4);
- last;
- }
+ while (not (@bbox) && defined (my $l = <FIN>)) {
+ print WRITE $l;
+ @bbox = ($1, $2, $3, $4)
+ if ($l =~ m/^\%\%BoundingBox: (\d+) (\d+) (\d+) (\d+)/);
}
die "Cannot guess input page size!" unless @bbox;
@@ -309,7 +306,7 @@ if (defined $crop) {
close READ or die "Can't close: $!";;
while (<FIN>) {
- print WRITE $_;
+ print WRITE;
}
exit;
}
@@ -367,7 +364,7 @@ EOF
# Body
while (<PS2PS>) {
- print FOUT $_ or die "Can't print: $!";
+ print FOUT or die "Can't print: $!";
# PStoPSclip hack: increase clipping box by 10
if ($_ =~ m/^userdict\/PStoPSclip{0 0 moveto$/) {