Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/nvi/usr.bin/recover Put back the tests for "no ...
details: https://anonhg.NetBSD.org/src/rev/d7a27d18673d
branches: trunk
changeset: 827580:d7a27d18673d
user: kre <kre%NetBSD.org@localhost>
date: Sat Nov 04 07:04:01 2017 +0000
description:
Put back the tests for "no files matched" (in a different way than they
were written previously - but that's just style.) This is not csh...
Use the correct test operator to test for an empty file (rather than
testing for an empty file name...)
Write test ('[') commands in a way that is defined to work, rather than
just happens to - we can afford the (negligible) performance hit here.
diffstat:
external/bsd/nvi/usr.bin/recover/virecover | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diffs (57 lines):
diff -r dc14337f70cc -r d7a27d18673d external/bsd/nvi/usr.bin/recover/virecover
--- a/external/bsd/nvi/usr.bin/recover/virecover Sat Nov 04 07:01:45 2017 +0000
+++ b/external/bsd/nvi/usr.bin/recover/virecover Sat Nov 04 07:04:01 2017 +0000
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $NetBSD: virecover,v 1.2 2017/11/04 05:43:18 christos Exp $
+# $NetBSD: virecover,v 1.3 2017/11/04 07:04:01 kre Exp $
#
# @(#)recover.in 8.8 (Berkeley) 10/10/96
#
@@ -11,14 +11,19 @@
# Check editor backup files.
for i in $RECDIR/vi.*; do
+
+ case "$i" in
+ $RECDIR/vi.\*) continue;;
+ esac
+
# Only test files that are readable.
- if [ \( ! -f "$i" \) -o \( ! -r "$i" \) ]; then
+ if ! [ -f "$i" ] || ! [ -r "$i" ]; then
continue
fi
# Unmodified nvi editor backup files either have the
# execute bit set or are zero length. Delete them.
- if [ \( -x "$i" \) -o \( -z "$i" \) ]; then
+ if [ -x "$i" ] || ! [ -s "$i" ]; then
rm -f "$i"
fi
done
@@ -26,8 +31,13 @@
# It is possible to get incomplete recovery files, if the editor crashes
# at the right time.
for i in $RECDIR/recover.*; do
+
+ case "$i" in
+ $RECDIR/recover.\*) continue;;
+ esac
+
# Only test files that are readable.
- if [ ! -r "$i" ]; then
+ if ! [ -r "$i" ]; then
continue
fi
@@ -35,7 +45,7 @@
# or that have no corresponding backup file. Else send mail
# to the user.
recfile=$(awk '/^X-vi-recover-path:/{print $2}' < "$i")
- if [ \( -n "$recfile" \) -a \( -s "$recfile" \); then
+ if [ -n "$recfile" ] && [ -s "$recfile" ]; then
$SENDMAIL -t < "$i"
else
rm -f "$i"
Home |
Main Index |
Thread Index |
Old Index