summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@chalmers.se>2010-09-25 21:41:35 +0200
committerGuilhem Moulin <guilhem.moulin@chalmers.se>2010-09-25 21:41:35 +0200
commit25517524c4dc59513647a401e4c4a87a11a94bde (patch)
treeeb9c36307f3868cc033f07ac983c489680370623
parent78b9eecee76e7a929ee3414603f809d90adebbc8 (diff)
Better printing of the number of pages
-rwxr-xr-xpsresize2.pl14
1 files changed, 11 insertions, 3 deletions
diff --git a/psresize2.pl b/psresize2.pl
index 2638cd3..483b413 100755
--- a/psresize2.pl
+++ b/psresize2.pl
@@ -210,7 +210,7 @@ if (defined $crop) {
# TODO: this `die' is actually useless, since it doesn't catch the
# signals of the child
- my $n = 0;
+ my ($p,$c) = (0,0); # Page & character counter
my ($x0, $y0, $x1, $y1) = (1<<16, 1<<16, -(1<<16), -(1<<16));
while (<GS>) {
if ($_ =~ m/^\%\%BoundingBox: (\d+) (\d+) (\d+) (\d+)/) {
@@ -218,11 +218,19 @@ if (defined $crop) {
$y0 = $2 if $2 < $y0;
$x1 = $3 if $3 > $x1;
$y1 = $4 if $4 > $y1;
- print STDERR "[", ++$n, "] " unless defined $quiet;
+ unless (defined $quiet) {
+ my $s = "[" . ++$p . "] ";
+ $c += length $s;
+ if ($c >= 80) {
+ print STDERR "\n";
+ $c = length $s;
+ }
+ print STDERR $s;
+ }
}
}
close GS;
- print STDERR "\n";
+ print STDERR "\n" unless defined $quiet;
# No zombie processes
waitpid $pid, 0;