diff options
author | Gerald Carter <jerry@samba.org> | 2001-05-31 18:34:57 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2001-05-31 18:34:57 +0000 |
commit | efb92db97dcd6171f351931d5dd6c615f5e5aac2 (patch) | |
tree | 667959e749bf4ebe1258b0681ca9cf59c0cd0675 | |
parent | 937b9b44b3477ac27046ce03bbc87b251e251ab2 (diff) | |
download | samba-efb92db97dcd6171f351931d5dd6c615f5e5aac2.tar.gz samba-efb92db97dcd6171f351931d5dd6c615f5e5aac2.tar.xz samba-efb92db97dcd6171f351931d5dd6c615f5e5aac2.zip |
go back to next_command() instead of next_token() when parsing
-c "..."
-rw-r--r-- | source/rpcclient/rpcclient.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/source/rpcclient/rpcclient.c b/source/rpcclient/rpcclient.c index 53d5b40698c..537d3249338 100644 --- a/source/rpcclient/rpcclient.c +++ b/source/rpcclient/rpcclient.c @@ -155,6 +155,23 @@ static void read_authfile ( return; } +static char* next_command (char** cmdstr) +{ + static pstring command; + char *p; + + if (!cmdstr || !(*cmdstr)) + return NULL; + + p = strchr(*cmdstr, ';'); + if (p) + *p = '\0'; + pstrcpy(command, *cmdstr); + *cmdstr = p; + + return command; +} + static void get_username (char *username) { if (getenv("USER")) @@ -648,18 +665,17 @@ static void usage(char *pname) cmd_set++; } - /* Do anything specified with -c */ - - if (cmdstr[0]) { - fstring cmd; - char *p = cmdstr; - - while(next_token(&p, cmd, ";", sizeof(fstring))) { - process_cmd(&cli, cmd); - } - - return 0; - } + /* Do anything specified with -c */ + if (cmdstr[0]) { + char *cmd; + char *p = cmdstr; + + while((cmd=next_command(&p)) != NULL) { + process_cmd(&cli, cmd); + } + + return 0; + } /* Loop around accepting commands */ |