#!/bin/sh

# evi -- look for errors in 'errlist' file and step through them,
#	 one at a time, allowing the user to type 'return' to skip them,
#	 or any character (such as a space) followed by 'return'
#	 to jump into the source file at the line of the error
#	 used in conjunction with 'emake' or 'err', it makes
#	 fixing errors much faster.  (i.e.:  emake all; evi )

# by Frank "Shaggy" Barrus

 
errfile=$1

if [ "x$errfile" = "x" ] ; then
	errfile=errlist
fi
 
$AWK -F: '
/^[^ ]*:[0-9]+:/ {
	printf $0;
	if((getline x < "-") <= 0) {
		print ""; exit;
	}
	if(x != "")
		system("vi +"$2" "$1)
	print "------"; next
	} 
 { print $0 } 
' $errfile
exit 0

