diff options
author | des <des@FreeBSD.org> | 2003-01-18 12:15:34 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-01-18 12:15:34 +0000 |
commit | f11f32abe2bdfbb1917abb397348345d899de081 (patch) | |
tree | 51261b5a91da27e03174547a46bedf3d0a276da6 | |
parent | 2555f8d918f9a430901768049407f2154424efc5 (diff) | |
download | FreeBSD-src-f11f32abe2bdfbb1917abb397348345d899de081.zip FreeBSD-src-f11f32abe2bdfbb1917abb397348345d899de081.tar.gz |
Don't truncate lines if an error occurred.
-rw-r--r-- | tools/tools/whereintheworld/whereintheworld.pl | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/tools/tools/whereintheworld/whereintheworld.pl b/tools/tools/whereintheworld/whereintheworld.pl index cf4d219..23654df 100644 --- a/tools/tools/whereintheworld/whereintheworld.pl +++ b/tools/tools/whereintheworld/whereintheworld.pl @@ -18,6 +18,7 @@ my @lines = (); my $thresh = 10; my $lastwasdash = 0; my $width = $ENV{COLUMNS} || 80; +my $error = 0; my $elided = 0; while ($line = <>) { @@ -36,25 +37,29 @@ while ($line = <>) { if ($line =~ /^=+>/) { @lines = (); } - if (length($line) >= $width) { - substr($line, $width - 7) = " [...]\n"; - } push(@lines, $line); if ($line =~ /^\*\*\* Error/ && $line !~ /\(ignored\)/) { - print @lines; + $error = 1; while ($line = <>) { - print $line; + push(@lines, $line); } - exit; + last; } } -print shift(@lines); -while (@lines > $thresh) { - shift(@lines); - ++$elided; +if (!$error) { + print shift(@lines); + while (@lines > $thresh) { + shift(@lines); + ++$elided; + } + if ($elided > 0) { + print "[$elided lines elided]\n"; + } } -if ($elided > 0) { - print "[$elided lines elided]\n"; +foreach $line (@lines) { + if (!$error && length($line) >= $width) { + substr($line, $width - 7) = " [...]\n"; + } + print $line; } -print @lines; |