#!/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; x=system(\
	"read x; if [ \"x$x\" = \"x\" ]; then exit 1; else exit 2; fi"); \
		if(x == 0) { print ""; exit; }; \
		if(x == 2) system("vi +" $2 " " $1); \
		print "------"; continue } \
	 { print $0 } ' $errfile

exit 0


