minix/external/bsd/nvi/dist/dist/recover.in
Lionel Sambuc 84d9c625bf Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
2014-07-28 17:05:06 +02:00

60 lines
1.3 KiB
Bash

#!/bin/sh -
#
# Id: recover.in,v 8.9 2001/08/30 13:59:23 skimo Exp (Berkeley) Date: 2001/08/30 13:59:23
#
# Script to recover nvi edit sessions.
RECDIR="@vi_cv_path_preserve@"
SENDMAIL="@vi_cv_path_sendmail@"
echo 'Recovering nvi editor sessions.'
# Check editor backup files.
vibackup=`echo $RECDIR/vi.*`
if [ "$vibackup" != "$RECDIR/vi.*" ]; then
for i in $vibackup; do
# Only test files that are readable.
if test ! -r $i; then
continue
fi
INUSE="@INUSE@"
if test "$INUSE" && $INUSE; then
continue
fi
# Unmodified nvi editor backup files either have the
# execute bit set or are zero length. Delete them.
if test -x $i -o ! -s $i; then
rm $i
fi
done
fi
# It is possible to get incomplete recovery files, if the editor crashes
# at the right time.
virecovery=`echo $RECDIR/recover.*`
if [ "$virecovery" != "$RECDIR/recover.*" ]; then
for i in $virecovery; do
# Only test files that are readable.
if test ! -r $i; then
continue
fi
INUSE="@INUSE@"
if test "$INUSE" && $INUSE; then
continue
fi
# Delete any recovery files that are zero length, corrupted,
# or that have no corresponding backup file. Else send mail
# to the user.
recfile=`awk '/^X-vi-recover-path:/{print $2}' < $i`
if test -n "$recfile" -a -s "$recfile"; then
$SENDMAIL -t < $i
else
rm $i
fi
done
fi