#!/bin/sh
# ~jhs/bin/.sh/spell_after_vi
# Called by ~jhs/src/bsd/fixes/FreeBSD/src/gen/share/mk/berklix.mk
# Calls /usr/local/bin/ispell or /usr/local/bin/aspell
# See Also: ~jhs/bin/.sh/spell_which

if test -e /usr/local/bin/ispell
	then
	# echo $0 debug sees /usr/local/bin/ispell
	spell="/usr/local/bin/ispell -x"
	# spell -x     Don't create a backup file.
elif test -e /usr/local/bin/aspell
	then
	# echo $0 debug sees /usr/local/bin/aspell
	spell="/usr/local/bin/aspell -c"
	# aspell -c = check.
else
	echo "Error: $0 no /usr/local/bin/ispell or /usr/local/bin/aspell"
	exit 1
fi

yes()
	{
	# echo Calling $spell $*
		# Note the $* is not params passed to this file script,
		# but params passed to this procedure by caller.
	$spell $*
	}
no()
	{
	echo Skipping $spell $*
	}

echo -n "$spell $* ? "
read edit
# echo EDIT is $edit
case ${edit} in
[Nn][Oo])
	no $*
	;;
[Nn])
	no $*
	;;
[Yy][Ee][Ss])
	yes $*
	;;
[Yy])
	yes $*
	;;
*)
	echo Error, Bad Answer, should be Yes or No, Assuming No.
	no
	;;
esac
