quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH 18/39] backup-files: Make input methods mutually excl


From: Jean Delvare
Subject: [Quilt-dev] [PATCH 18/39] backup-files: Make input methods mutually exclusive
Date: Sat, 19 Mar 2011 10:52:48 +0100
User-agent: quilt/0.48-17.1

Make the various file list selection methods mutually exclusive.
This is the actual usage scheme by quilt, and handling them
separately makes the code both clearer and more efficient.

Signed-off-by: Jean Delvare <address@hidden>
Reviewed-by: Raphael Hertzog <address@hidden>
---
 quilt/scripts/backup-files.in |   35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

--- a/quilt/scripts/backup-files.in
+++ b/quilt/scripts/backup-files.in
@@ -27,10 +27,9 @@ set -e
 # name prefix for the backup files must be specified with the -B option.
 
 usage () {
-       echo "Usage: $0 [-B prefix] [-f {file|-}] [-s] [-k] [-t] [-L] 
[-b|-r|-x] {file|-} ...
+       echo "Usage: $0 -B prefix [-s] [-k] [-t] [-L] [-b|-r|-x] {-f 
{file|-}|-|file ...}
 
-       Create hard linked backup copies of a list of files
-       read from standard input.
+       Create or restore backup copies of a list of files.
 
        -b      Create backup
        -r      Restore the backup
@@ -188,24 +187,22 @@ if [ -n "$OPT_FILE" ]; then
        | while read nextfile; do
                $OPT_WHAT "$nextfile"
        done
+       exit
 fi
 
-while [ $# -gt 0 ]; do
-       case $1 in
-       -)
-               find "$OPT_PREFIX" -type f -print \
-               | while read
-               do
-                       $OPT_WHAT "${REPLY#$OPT_PREFIX}"
-               done
-               if [ ${PIPESTATUS[0]} != 0 ]; then
-                       exit 1
-               fi
-               ;;
-       *)
-               $OPT_WHAT "$1"
-               ;;
-       esac
+if [ "$1" = - ]; then
+       find "$OPT_PREFIX" -type f -print \
+       | while read
+       do
+               $OPT_WHAT "${REPLY#$OPT_PREFIX}"
+       done
+       if [ ${PIPESTATUS[0]} != 0 ]; then
+               exit 1
+       fi
+       exit
+fi
 
+while [ $# -gt 0 ]; do
+       $OPT_WHAT "$1"
        shift
 done




reply via email to

[Prev in Thread] Current Thread [Next in Thread]