summaryrefslogtreecommitdiff
path: root/etc/rc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-09-04 22:20:21 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-09-04 22:20:21 +0000
commitefd076d2b4c4c4ba62e3d7a8a78385c14cc795e4 (patch)
tree057b93c387097c954c37edc2b23b002c28bf9d24 /etc/rc
parent97308e86b60faa4fb85faf5045da35deccda3a40 (diff)
Actually, vi file recivery was not happening on reboot due to a
mistaken assumption. Noted by dynamo@ime.net. Fixed by moving the check for meta character expansion to be inside the two for loops. They are expanded by simple assignment.
Diffstat (limited to 'etc/rc')
-rw-r--r--etc/rc51
1 files changed, 25 insertions, 26 deletions
diff --git a/etc/rc b/etc/rc
index def375eacc3..a7c8b6105c5 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,4 +1,4 @@
-# $OpenBSD: rc,v 1.110 1999/09/04 21:30:49 millert Exp $
+# $OpenBSD: rc,v 1.111 1999/09/04 22:20:20 millert Exp $
# System startup script run by init on autoboot
# or after single-user.
@@ -339,35 +339,34 @@ elif [ ! -d $vidir ]; then
chmod 1777 $vidir
else
vibackup=$vidir/vi.*
- if [ "$vibackup" != "$vidir/vi.*" ]; then
- for i in $vibackup; do
- # Unmodified vi editor backup files either have the
- # execute bit set or are zero length. Delete them.
- # Anything that is not a normal file gets deleted too.
- if [ -x $i -o ! -s $i -o ! -f $i ]; then
- rm $i
- fi
- done
- fi
+ for i in $vibackup; do
+ [ "$i" = "$vibackup" ] && break
+ # Unmodified vi editor backup files either have the
+ # execute bit set or are zero length. Delete them.
+ # Anything that is not a normal file gets deleted too.
+ if [ -x $i -o ! -s $i -o ! -f $i ]; then
+ rm $i
+ fi
+ done
+
virecovery=$vidir/recover.*
- if [ "$virecovery" != "$vidir/recover.*" ]; then
- echo preserving editor files
- for i in $virecovery; do
- # Delete any recovery files that are zero length,
- # corrupted, # or that have no corresponding backup
- # file. Else send mail to the user.
- if [ -f $i ]; then
- r=`awk '/^X-vi-recover-path:/{print $2}' < $i`
- if [ -n "$r" -a -s "$r" ]; then
- sendmail -t < $i
- else
- rm $i
- fi
+ echo preserving editor files
+ for i in $virecovery; do
+ [ "$i" = "$virecovery" ] && break
+ # Delete any recovery files that are zero length,
+ # corrupted, # or that have no corresponding backup
+ # file. Else send mail to the user.
+ if [ -f $i ]; then
+ recfile=`awk '/^X-vi-recover-path:/{print $2}' < $i`
+ if [ -n "$recfile" -a -s "$recfile" ]; then
+ sendmail -t < $i
else
rm $i
fi
- done
- fi
+ else
+ rm $i
+ fi
+ done
fi
if [ -f /var/account/acct ]; then