Module Name: src Committed By: kre Date: Sat Nov 4 07:04:01 UTC 2017
Modified Files: src/external/bsd/nvi/usr.bin/recover: virecover Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/nvi/usr.bin/recover/virecover Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/nvi/usr.bin/recover/virecover diff -u src/external/bsd/nvi/usr.bin/recover/virecover:1.2 src/external/bsd/nvi/usr.bin/recover/virecover:1.3 --- src/external/bsd/nvi/usr.bin/recover/virecover:1.2 Sat Nov 4 05:43:18 2017 +++ src/external/bsd/nvi/usr.bin/recover/virecover Sat Nov 4 07:04:01 2017 @@ -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 @@ SENDMAIL="/usr/sbin/sendmail" # 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 @@ done # 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 @@ for i in $RECDIR/recover.*; do # 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"