diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2010-11-22 15:18:10 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2010-11-22 15:18:41 -0800 |
commit | 27225be1a371d7216d96d80f08e5290accfb9b66 (patch) | |
tree | 18f52deb1bd0d0a41186d7a9616f7b84129441f7 | |
parent | 73d0d1a0f883be5f67534362c99382f1eae8d178 (diff) | |
download | tar-27225be1a371d7216d96d80f08e5290accfb9b66.tar.gz |
scripts: fix option parsing
Problem reported by Dennis Wydra in
<http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00082.html>.
* scripts/backup.in: Accept "-l LEVEL". Be more systematic about
backslashes inside ``; it shouldn't matter for modern shells but
it might matter for older ones.
* scripts/restore.in: Likewise.
* scripts/backup.in: Adjust implementation of -t/--time to match
the new implementation of -l/--level.
-rw-r--r-- | scripts/backup.in | 12 | ||||
-rw-r--r-- | scripts/restore.in | 5 |
2 files changed, 9 insertions, 8 deletions
diff --git a/scripts/backup.in b/scripts/backup.in index 6a50e51d..37bfed36 100644 --- a/scripts/backup.in +++ b/scripts/backup.in @@ -72,8 +72,9 @@ do --l=*|--le=*|--lev=*|--leve=*|--level=*) DUMP_LEVEL=$optarg ;; + -l?*) DUMP_LEVEL=`expr $option : '-l\(.*\)'`;; -l|--l|--le|--lev|--leve|--level) - prev=$option + prev=--level ;; --verb=*|--verbo=*|--verbos=*|--verbose=*) VERBOSE=$optarg @@ -81,14 +82,13 @@ do -v|--verb|--verbo|--verbos|--verbose) VERBOSE=100 ;; - -v*) VERBOSE=`expr $option : "-v\(.*\)"`;; + -v*) VERBOSE=`expr $option : '-v\(.*\)'`;; --t=*|--ti=*|--tim=*|--time=*) TIME=$optarg ;; - -t) prev=--t;; - -t*) TIME=`expr $option : "-t\(.*\)"`;; - --t|--ti|--tim|--time) - prev=$option + -t?*) TIME=`expr $option : '-t\(.*\)'`;; + -t|--t|--ti|--tim|--time) + prev=--time ;; -V|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "backup (@PACKAGE_NAME@) @VERSION@" diff --git a/scripts/restore.in b/scripts/restore.in index efc320ad..2f86bacf 100644 --- a/scripts/restore.in +++ b/scripts/restore.in @@ -60,8 +60,9 @@ do --l=*|--le=*|--lev=*|--leve=*|--level=*) DUMP_LEVEL=$optarg ;; + -l?*) DUMP_LEVEL=`expr $option : '-l\(.*\)'`;; -l|--l|--le|--lev|--leve|--level) - prev=$option + prev=--level ;; --verb=*|--verbo=*|--verbos=*|--verbose=*) VERBOSE=$optarg @@ -69,7 +70,7 @@ do -v|--verb|--verbo|--verbos|--verbose) VERBOSE=100 ;; - -v*) VERBOSE=`expr $option : "-v\(.*\)"`;; + -v*) VERBOSE=`expr $option : '-v\(.*\)'`;; -V|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "restore (@PACKAGE_NAME@) @VERSION@" license |