:   HINT
H='
=========
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.
=========
'
case $1 in
    -h|help|hint)   clear;echo "$H";exit 0;;
    *)  ;;
esac
W=/usr/tmp/work$$
CF=changes.tmp
CL=
trap '/bin/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
beepo "($0) <no write permission> $i"
exit 69
fi
echo -n $i
sed -f $S $i > $W
if test -s $W
then
cmp -s $i $W
case $? in
    0)  echo " no change";continue;;
    1)  echo -n " rebuilding";;
    *)  echo "<FUBAR>";exit 1;;
esac
chmod 644 $i
cp $W $i
rm -f $W
CL="$i $CL"
echo " done"
else
echo " no output from"
continue
fi
done
echo $CL > $CF
