3 # $NetBSD: virecover,v 1.1 2008/09/02 09:25:39 christos Exp $
5 # @(#)recover.in 8.8 (Berkeley) 10/10/96
7 # Script to recover nvi edit sessions.
9 RECDIR
="/var/tmp/vi.recover"
10 SENDMAIL
="/usr/sbin/sendmail"
12 # Check editor backup files.
13 vibackup
=`echo $RECDIR/vi.*`
14 if [ "$vibackup" != "$RECDIR/vi.*" ]; then
15 for i
in $vibackup; do
16 # Only test files that are readable.
17 if test ! -f $i ||
test ! -r $i; then
21 # Unmodified nvi editor backup files either have the
22 # execute bit set or are zero length. Delete them.
23 if test -x $i -o ! -s $i; then
29 # It is possible to get incomplete recovery files, if the editor crashes
31 virecovery
=`echo $RECDIR/recover.*`
32 if [ "$virecovery" != "$RECDIR/recover.*" ]; then
33 for i
in $virecovery; do
34 # Only test files that are readable.
39 # Delete any recovery files that are zero length, corrupted,
40 # or that have no corresponding backup file. Else send mail
42 recfile
=`awk '/^X-vi-recover-path:/{print $2}' < $i`
43 if test -n "$recfile" -a -s "$recfile"; then