From 25517524c4dc59513647a401e4c4a87a11a94bde Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 25 Sep 2010 21:41:35 +0200 Subject: Better printing of the number of pages --- psresize2.pl | 14 +++++++++++--- 1 file 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 () { 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; -- cgit v1.2.3