diff options
author | Gerald Carter <jerry@samba.org> | 2001-05-31 18:35:14 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2001-05-31 18:35:14 +0000 |
commit | 9c2f185242030573a301e1944295c3295a0146f4 (patch) | |
tree | 2fdfc60a5037170e295096388328600e8b040662 /source3 | |
parent | d1e46067408bca1f4beb8d15881b0a589509b1f5 (diff) | |
download | samba-9c2f185242030573a301e1944295c3295a0146f4.tar.gz samba-9c2f185242030573a301e1944295c3295a0146f4.tar.bz2 samba-9c2f185242030573a301e1944295c3295a0146f4.zip |
merge from 2.2
(This used to be commit c827787d679b3bbf9f57ff6d5aaab150456b1662)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpcclient/rpcclient.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 53d5b40698..537d324933 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/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 */ |