summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-10-15 16:28:30 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-10-15 16:28:30 +0000
commit98004a20a207ec5acedf0d045fd5d21a5e13eedc (patch)
tree55dd5579c3c339acd526a19fce21271a2d80a719 /etc
parentf5ac8e38e6a3f29848596f7a627e9ef1381250da (diff)
Add rest of stuff from nvi's recover script.
Diffstat (limited to 'etc')
-rw-r--r--etc/rc23
1 files changed, 21 insertions, 2 deletions
diff --git a/etc/rc b/etc/rc
index 3d63e783f66..a9bd094ca4c 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,4 +1,4 @@
-# $OpenBSD: rc,v 1.50 1997/09/30 04:54:50 millert Exp $
+# $OpenBSD: rc,v 1.51 1997/10/15 16:28:29 millert Exp $
# System startup script run by init on autoboot
# or after single-user.
@@ -242,6 +242,7 @@ sed '1,/^$/d' < /etc/motd >> $T
cmp -s $T /etc/motd || cp $T /etc/motd
rm -f $T
+# nvi file recovery
if [ ! -d /var/tmp/vi.recover ]; then
if [ -e /var/tmp/vi.recover ]; then
echo "Warning! /var/tmp/vi.recover is not a directory!"
@@ -250,11 +251,29 @@ if [ ! -d /var/tmp/vi.recover ]; then
chmod 1777 /var/tmp/vi.recover
fi
fi
+vibackup=/var/tmp/vi.recover/vi.*
+if [ "$vibackup" != "/var/tmp/vi.recover/vi.*" ]; then
+ for i in $vibackup; do
+ # 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
virecovery=/var/tmp/vi.recover/recover.*
if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
echo preserving editor files
for i in $virecovery; do
- sendmail -t < $i
+ # 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