summaryrefslogtreecommitdiffstats
path: root/source/rpcclient/rpcclient.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2001-05-31 18:35:14 +0000
committerGerald Carter <jerry@samba.org>2001-05-31 18:35:14 +0000
commitc827787d679b3bbf9f57ff6d5aaab150456b1662 (patch)
tree35c04fda165733032b40b84a15b5108fac13e23c /source/rpcclient/rpcclient.c
parente30a3be954c0eacb3ccffdaa1165a9f0e8b93a23 (diff)
downloadsamba-c827787d679b3bbf9f57ff6d5aaab150456b1662.tar.gz
samba-c827787d679b3bbf9f57ff6d5aaab150456b1662.tar.xz
samba-c827787d679b3bbf9f57ff6d5aaab150456b1662.zip
merge from 2.2
Diffstat (limited to 'source/rpcclient/rpcclient.c')
-rw-r--r--source/rpcclient/rpcclient.c40
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 */