summaryrefslogtreecommitdiff
path: root/usr.bin/vi/perl_scripts/make.pl
blob: 118dd99a424cc04314960ecb4b12432c87b2f637 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
sub make {
    open MAKE, "make 2>&1 1>/dev/null |";
    while(<MAKE>) {
	if (($file, $line, $msg) = /([^: ]*):(\d*):(.+)/) {
	    if ($file == $prevfile && $line == $prevline) {
		$error[-1]->[2] .= "\n$msg";
	    } else {
		push @error, [$file, $line, $msg];
		($prevline, $prevfile) = ($line, $file);
	    }
	}
    }
    close MAKE;
}

sub nexterror {
    if ($index <= $#error) {
    	my $error = $error[$index++];
    	$curscr->Edit($error->[0]);
	$curscr->SetCursor($error->[1],0);
	$curscr->Msg($error->[2]);
    }
}

# preverror is left as an exercise

1;