summaryrefslogtreecommitdiffstats
path: root/source3/client/clitar.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-08-01 21:09:10 +0000
committerJeremy Allison <jra@samba.org>2003-08-01 21:09:10 +0000
commit72a8b313036092d3133c010257218ab60c1ca808 (patch)
tree47879b746536c5e9eae3e5a2702fab391b5e3fa1 /source3/client/clitar.c
parentbfb312800fe3bb60cacb11c96f8b6c96c66fee0a (diff)
downloadsamba-72a8b313036092d3133c010257218ab60c1ca808.tar.gz
samba-72a8b313036092d3133c010257218ab60c1ca808.tar.xz
samba-72a8b313036092d3133c010257218ab60c1ca808.zip
Fix the option processing for smbtar. Does no one check this !
Jeremy. (This used to be commit c4af1ec73584656fb9d2b372461da4748e1643f1)
Diffstat (limited to 'source3/client/clitar.c')
-rw-r--r--source3/client/clitar.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 5e8414e0837..5295de8010b 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -1585,6 +1585,7 @@ Parse tar arguments. Sets tar_type, tar_excl, etc.
int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
{
+ int newOptind = Optind;
char tar_clipfl='\0';
/* Reset back to defaults - could be from interactive version
@@ -1612,6 +1613,7 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
return 0;
} else {
Optind++;
+ newOptind++;
}
break;
case 'g':
@@ -1629,6 +1631,7 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
newer_than = stbuf.st_mtime;
DEBUG(1,("Getting files newer than %s",
asctime(LocalTime(&newer_than))));
+ newOptind++;
Optind++;
} else {
DEBUG(0,("Error setting newer-than time\n"));
@@ -1696,7 +1699,9 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
DEBUG(0,("Option F must be followed by exactly one filename.\n"));
return 0;
}
- if (! read_inclusion_file(argv[Optind+1])) {
+ newOptind++;
+ Optind++;
+ if (! read_inclusion_file(argv[Optind])) {
return 0;
}
} else if (Optind+1<argc && !tar_re_search) { /* For backwards compatibility */
@@ -1731,6 +1736,8 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
cliplist = tmplist;
must_free_cliplist = True;
+
+ newOptind += clipn;
}
if (Optind+1<argc && tar_re_search) { /* Doing regular expression seaches */
@@ -1755,6 +1762,7 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
clipn=argc-Optind-1;
cliplist=argv+Optind+1;
+ newOptind += clipn;
}
if (Optind>=argc || !strcmp(argv[Optind], "-")) {
@@ -1767,6 +1775,10 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
if (tarhandle == 1) {
dbf = x_stderr;
}
+ if (!strcmp(argv[Optind], "-")) {
+ newOptind++;
+ }
+
} else {
if (tar_type=='c' && (dry_run || strcmp(argv[Optind], "/dev/null")==0)) {
if (!dry_run) {
@@ -1779,7 +1791,8 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
DEBUG(0,("Error opening local file %s - %s\n", argv[Optind], strerror(errno)));
return(0);
}
+ newOptind++;
}
- return 1;
+ return newOptind;
}