|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T e
Length: 1538 (0x602)
Types: TextFile
Names: »editentry«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z«
└─⟦de7628f85⟧
└─⟦this⟧ »isode-6.0/quipu/dish/editentry«
#!/bin/sh
#
if [ $# != "1" ]; then
echo usage: editentry filename
exit 1
fi
F=T
while test -z "$EDITOR"
do
if [ $F = "T" ]; then
echo 'You do not have the shell variable $EDITOR set.'
F=F
fi
echo ''
echo -n 'Enter the name of an editor: '
read EDITOR rubbish
if [ ! -x "$EDITOR" ]; then
IFSS="$IFS"
IFS=: F="$EDITOR"
EDITOR=
for D in $PATH; do
if [ -x "$D/$F" ]; then
EDITOR="$D/$F"
break
fi
done
if [ -z "$EDITOR" ]; then
echo "$F not found, please try again..."
fi
IFS="$IFSS"
fi
done
cp $1 $1.tmp
E=T
while true
do
if [ $E = "T" ]; then
if $EDITOR $1; then
if cmp -s $1 $1.tmp; then
mess="No changes to draft entry - shall I continue? "
else
mess="Are you sure you want to make these changes? "
fi
else
echo 'Edit aborted...'
rm -f $1.tmp
exit 1
fi
fi
echo -n "$mess"
read YN rubbish
case "$YN" in
y|yes|Y|YES)
rm -f $1.tmp
exit 0
;;
n|no|N|NO)
mv $1.tmp $1
exit 1
;;
e|edit|E|EDIT)
cp $1 $1.tmp
E=T
;;
u|undo|U|UNDO)
cp $1.tmp $1
E=T
;;
*)
case "$YN" in
\?|""|h|help|H|HELP)
mess='Options are:'
;;
*)
mess="\"$YN\" not understood -- use one of:"
;;
esac
echo "$mess"
echo ' yes - to commit'
echo ' no - to abort'
echo ' edit - to continue editing'
echo ' undo - to undo last edit and edit some more'
mess='Try again: '
E=F
;;
esac
done