summaryrefslogtreecommitdiff
path: root/source3/client/clitar.c
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2007-12-22 14:01:44 -0800
committerJames Peach <jpeach@samba.org>2007-12-22 14:01:44 -0800
commitbf2269a04e5af056037c392fb7f29014b62d1bb2 (patch)
tree38a2c68c2835bb65725003dd479a3a6fdbee1a51 /source3/client/clitar.c
parent1176e04c76e28d9ee9ab355c5e9edcd1b627ac03 (diff)
parenta000fa4ee5491ae32c60881b28b3536e88e82e27 (diff)
downloadsamba-bf2269a04e5af056037c392fb7f29014b62d1bb2.tar.gz
samba-bf2269a04e5af056037c392fb7f29014b62d1bb2.tar.bz2
samba-bf2269a04e5af056037c392fb7f29014b62d1bb2.zip
Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test
(This used to be commit 30cb2d215f1a4a440d5ecaab3f898daa714eee2b)
Diffstat (limited to 'source3/client/clitar.c')
-rw-r--r--source3/client/clitar.c60
1 files changed, 55 insertions, 5 deletions
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 0b4a8b2943..135815c3cd 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -100,6 +100,7 @@ char tar_type='\0';
static char **cliplist=NULL;
static int clipn=0;
static bool must_free_cliplist = False;
+static const char *cmd_ptr = NULL;
extern bool lowercase;
extern uint16 cnum;
@@ -1273,7 +1274,7 @@ int cmd_block(void)
char *buf;
int block;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
DEBUG(0, ("blocksize <n>\n"));
return 1;
}
@@ -1298,7 +1299,7 @@ int cmd_tarmode(void)
TALLOC_CTX *ctx = talloc_tos();
char *buf;
- while (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
if (strequal(buf, "full"))
tar_inc=False;
else if (strequal(buf, "inc"))
@@ -1348,7 +1349,7 @@ int cmd_setmode(void)
attra[0] = attra[1] = 0;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
DEBUG(0, ("setmode <filename> <[+|-]rsha>\n"));
return 1;
}
@@ -1361,7 +1362,7 @@ int cmd_setmode(void)
return 1;
}
- while (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
q=buf;
while(*q) {
@@ -1402,6 +1403,55 @@ int cmd_setmode(void)
return 0;
}
+/**
+ Convert list of tokens to array; dependent on above routine.
+ Uses the global cmd_ptr from above - bit of a hack.
+**/
+
+static char **toktocliplist(int *ctok, const char *sep)
+{
+ char *s=(char *)cmd_ptr;
+ int ictok=0;
+ char **ret, **iret;
+
+ if (!sep)
+ sep = " \t\n\r";
+
+ while(*s && strchr_m(sep,*s))
+ s++;
+
+ /* nothing left? */
+ if (!*s)
+ return(NULL);
+
+ do {
+ ictok++;
+ while(*s && (!strchr_m(sep,*s)))
+ s++;
+ while(*s && strchr_m(sep,*s))
+ *s++=0;
+ } while(*s);
+
+ *ctok=ictok;
+ s=(char *)cmd_ptr;
+
+ if (!(ret=iret=SMB_MALLOC_ARRAY(char *,ictok+1)))
+ return NULL;
+
+ while(ictok--) {
+ *iret++=s;
+ if (ictok > 0) {
+ while(*s++)
+ ;
+ while(!*s)
+ s++;
+ }
+ }
+
+ ret[*ctok] = NULL;
+ return ret;
+}
+
/****************************************************************************
Principal command for creating / extracting
***************************************************************************/
@@ -1414,7 +1464,7 @@ int cmd_tar(void)
int argcl = 0;
int ret;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
DEBUG(0,("tar <c|x>[IXbgan] <filename>\n"));
return 1;
}