HINT=NO
case $1 in
	-h|help|hint)	HINT=YES;;
	*)				;;
esac
if test $HINT = YES
then
pg - <<\END_HINT
clear
==========
tinsert
==========
inserts error messages pertaining to ".bs" citations in the
text that produced the errors.  these messages are assumed
to be in a file "notfound.log" in the current directory. a
script to call "vi" for the massaged files is placed in
"notfound.cmd"
==========
SEE ALSO
==========
tmakefile
==========
END_HINT
exit
fi
T=${TMPDIR=/usr/tmp}/ti$$.tmp
trap 'rm -f $T;exit' 0 1 2 3 14
cat > $T <<\AWK_END
BEGIN{
	pfn = "START"
	nen = 0
	nfl = "notfound.cmd"
	}
/^\.mo AMBIGUOUS/{
	next
	}
/^\.mo NOT FOUND/{
	next
	}
	{
	if($6 != pfn)	{
		if(pfn != "START")	printf("w %s\n",pfn);
		printf("e %s\n",$6);
		printf("g/^\.mo NF LN/d\n");
		printf("g/^\.mo AM LN/d\n");
		efn[nen] = pfn = $6
		nen += 1
		en = 0
		}
	printf("%di\n%s\n.\n",$4+en,$0)
	en += 1
	}
END{
	if(nen == 0)	exit
	printf("wq\n")
	printf("vi +1") > nfl
	for(i = 0; i < nen; i++)	printf(" %s",efn[i]) > nfl
	printf("\n") > nfl
	}
AWK_END
awk -f $T notfound.log | vi -e -
