]> Dogcows Code - chaz/tar/commitdiff
scripts: fix option parsing
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 22 Nov 2010 23:18:10 +0000 (15:18 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 22 Nov 2010 23:18:41 +0000 (15:18 -0800)
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.

scripts/backup.in
scripts/restore.in

index 6a50e51d60c9fc21f9190a4d3470cfbb5246e49e..37bfed3612d4004d6bdadfb098f1e9348b2f2a40 100644 (file)
@@ -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@"
index efc320ad7b2330bf0fc1d7e15f375833161765ce..2f86bacfce03093f447a606339f4eb5f603fcda1 100644 (file)
@@ -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
This page took 0.023657 seconds and 4 git commands to generate.