HINT=NO
case $1 in
	-h)		HINT=YES;;
	-help)	HINT=YES;;
	-hint)	HINT=YES;;
esac
if test $HINT = YES
then
clear
more <<END
=========
ksedit [-f script] file(s)
=========
apply the named script (default sedscript) to the listed
files. if no change results the original file is not
touched, otherwise it is rewritten. a list of the changed
files is written to changes.tmp in the current directory.
=========
BUGS
=========
files always have permission 644 if touched by ksedit.
=========
END
fi
W=/usr/tmp/work$$
W=${TMPDIR=/usr/tmp}/work$$
CF=changes.tmp
CL=
trap 'rm -f $W;exit' 0 1 2 3 4 14
S="sedscript"
case $1 in
    -f)     shift;S=$1;shift;;
    *)      ;;
esac
for i in $*
do
if test $i = $S
then
continue
fi
if test ! -w $i
then
echo "($0) <no write permission> $i"
exit 69
fi
echo "\c$i "
sed -f $S $i > $W
if test -s $W
then
cmp -s $i $W
case $? in
    0)  echo " no change";continue;;
    1)  echo "\c rebuilding";;
    *)  echo "<FUBAR>";exit 1;;
esac
cp $W $i
rm -f $W
CL="$i $CL"
echo " done"
else
echo " no output from"
continue
fi
done
echo $CL > $CF
