1#!/usr/bin/perl -w 2# 3# whereintheworld 4# Parses "make world" output and summarize where it's been so far. 5# 6# Bill Fenner <fenner@freebsd.org> 11 January 2000 7# Dag-Erling Smørgrav <des@freebsd.org> 09 January 2003 8# 9# $Id: whereintheworld,v 1.3 2000/01/28 00:42:32 fenner Exp $ 10# 11 12use strict; 13 14my $line; 15my $inside = 0; 16my @lines = (); 17my $thresh = 10; 18my $lastwasdash = 0; 19my $width = $ENV{COLUMNS} || 80; 20my $error = 0; 21my $elided = 0; 22 23while ($line = <>) { 24 if ($line =~ /^------------/) { 25 $inside = !$inside; 26 print $line unless ($lastwasdash); 27 $lastwasdash = 1; 28 @lines = (); 29 next; 30 } 31 if ($inside && $line =~ /^>>>/) { 32 print $line; 33 $lastwasdash = 0; 34 next; 35 } 36 if ($line =~ /^TB /) { 37 print $line; 38 next; 39 } 40 if ($line =~ /^=+>/) { 41 @lines = (); 42 } 43 push(@lines, $line); 44 if ($line =~ /^\*\*\* Error/ && $line !~ /\(ignored\)/) { 45 $error = 1; 46 while ($line = <>) { 47 push(@lines, $line); 48 } 49 last; 50 } 51} 52 53if (@lines && !$error) { 54 print shift(@lines); 55 while (@lines > $thresh) { 56 shift(@lines); 57 ++$elided; 58 } 59 if ($elided > 0) { 60 print "[$elided lines elided]\n"; 61 } 62} 63foreach $line (@lines) { 64 if (!$error && $line !~ m/^TB / && length($line) >= $width) { 65 substr($line, $width - 7) = " [...]\n"; 66 } 67 print $line; 68} 69