Merge from vendor branch CVS:
[dragonfly.git] / contrib / nvi / perl_scripts / make.pl
1 sub make {
2     open MAKE, "make 2>&1 1>/dev/null |";
3     while(<MAKE>) {
4         if (($file, $line, $msg) = /([^: ]*):(\d*):(.+)/) {
5             if ($file == $prevfile && $line == $prevline) {
6                 $error[-1]->[2] .= "\n$msg";
7             } else {
8                 push @error, [$file, $line, $msg];
9                 ($prevline, $prevfile) = ($line, $file);
10             }
11         }
12     }
13     close MAKE;
14 }
15
16 sub nexterror {
17     if ($index <= $#error) {
18         my $error = $error[$index++];
19         $curscr->Edit($error->[0]);
20         $curscr->SetCursor($error->[1],0);
21         $curscr->Msg($error->[2]);
22     }
23 }
24
25 # preverror is left as an exercise
26
27 1;