summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-22 19:25:30 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-22 19:25:30 +0000
commit48a4df7dac6e076bee0a1de9540108676792377b (patch)
tree51a0d6402eefcbd89fabd3228fedf6eeb5cf86f6 /source3/rpcclient
parentaa12f3e0e922f42318b71c601cba08a6c96ff486 (diff)
downloadsamba-48a4df7dac6e076bee0a1de9540108676792377b.tar.gz
samba-48a4df7dac6e076bee0a1de9540108676792377b.tar.bz2
samba-48a4df7dac6e076bee0a1de9540108676792377b.zip
moved two more commands over to getopt.
(This used to be commit de360d1e908b4e2e77cd028b19f3ccd07903a4dd)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_svcctl.c49
-rw-r--r--source3/rpcclient/cmd_wkssvc.c5
2 files changed, 32 insertions, 22 deletions
diff --git a/source3/rpcclient/cmd_svcctl.c b/source3/rpcclient/cmd_svcctl.c
index f20d8e30d6..9e9e3c82bb 100644
--- a/source3/rpcclient/cmd_svcctl.c
+++ b/source3/rpcclient/cmd_svcctl.c
@@ -80,7 +80,7 @@ void cmd_svc_info(struct client_info *info, int argc, char *argv[])
uint16 fnum;
BOOL res = True;
BOOL res1 = True;
- fstring svc_name;
+ char *svc_name;
POLICY_HND pol_scm;
@@ -92,12 +92,14 @@ void cmd_svc_info(struct client_info *info, int argc, char *argv[])
DEBUG(4,("cmd_svc_info: server:%s\n", srv_name));
- if (!next_token(NULL, svc_name, NULL, sizeof(svc_name)))
+ if (argc < 2)
{
report(out_hnd,"svcinfo <service name>\n");
return;
}
+ svc_name = argv[1];
+
/* open SVCCTL session. */
res = res ? cli_nt_session_open(smb_cli, PIPE_SVCCTL, &fnum) : False;
@@ -220,12 +222,22 @@ void cmd_svc_enum(struct client_info *info, int argc, char *argv[])
{
ENUM_SRVC_STATUS *svcs = NULL;
uint32 num_svcs = 0;
- fstring tmp;
BOOL request_info = False;
+ int opt;
+
+ argc--;
+ argv++;
- if (next_token(NULL, tmp, NULL, sizeof(tmp)))
+ while ((opt = getopt(argc, argv,"i")) != EOF)
{
- request_info = strequal(tmp, "-i");
+ switch (opt)
+ {
+ case 'i':
+ {
+ request_info = True;
+ break;
+ }
+ }
}
report(out_hnd,"Services\n");
@@ -249,7 +261,7 @@ void cmd_svc_stop(struct client_info *info, int argc, char *argv[])
uint16 fnum;
BOOL res = True;
BOOL res1 = True;
- fstring svc_name;
+ char *svc_name;
BOOL res2 = True;
POLICY_HND pol_svc;
POLICY_HND pol_scm;
@@ -262,12 +274,14 @@ void cmd_svc_stop(struct client_info *info, int argc, char *argv[])
DEBUG(4,("cmd_svc_stop: server:%s\n", srv_name));
- if (!next_token(NULL, svc_name, NULL, sizeof(svc_name)))
+ if (argc < 2)
{
report(out_hnd,"svcstop <service name>\n");
return;
}
+ svc_name = argv[1];
+
/* open SVCCTL session. */
res = res ? cli_nt_session_open(smb_cli, PIPE_SVCCTL, &fnum) : False;
@@ -308,13 +322,10 @@ void cmd_svc_start(struct client_info *info, int argc, char *argv[])
uint16 fnum;
BOOL res = True;
BOOL res1 = True;
- fstring svc_name;
- fstring tmp;
+ char *svc_name;
BOOL res2 = True;
POLICY_HND pol_svc;
POLICY_HND pol_scm;
- uint32 argc = 0;
- char **argv = NULL;
fstring srv_name;
@@ -324,16 +335,19 @@ void cmd_svc_start(struct client_info *info, int argc, char *argv[])
DEBUG(4,("cmd_svc_start: server:%s\n", srv_name));
- if (!next_token(NULL, svc_name, NULL, sizeof(svc_name)))
+ if (argc < 2)
{
report(out_hnd,"svcstart <service name> [arg 0] [arg 1]...]\n");
return;
}
- while (next_token(NULL, tmp, NULL, sizeof(tmp)))
- {
- add_chars_to_array(&argc, &argv, tmp);
- }
+ argc++;
+ argc--;
+
+ svc_name = argv[0];
+
+ argc++;
+ argc--;
/* open SVCCTL session. */
res = res ? cli_nt_session_open(smb_cli, PIPE_SVCCTL, &fnum) : False;
@@ -366,8 +380,5 @@ void cmd_svc_start(struct client_info *info, int argc, char *argv[])
{
DEBUG(5,("cmd_svc_start: failed\n"));
}
-
- free_char_array(argc, argv);
-
}
diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c
index 426e6690a0..23f7a88d27 100644
--- a/source3/rpcclient/cmd_wkssvc.c
+++ b/source3/rpcclient/cmd_wkssvc.c
@@ -45,7 +45,6 @@ void cmd_wks_query_info(struct client_info *info, int argc, char *argv[])
{
uint16 nt_pipe_fnum;
fstring dest_wks;
- fstring tmp;
WKS_INFO_100 ctr;
uint32 info_level = 100;
@@ -57,9 +56,9 @@ void cmd_wks_query_info(struct client_info *info, int argc, char *argv[])
fstrcat(dest_wks, info->dest_host);
strupper(dest_wks);
- if (next_token(NULL, tmp, NULL, sizeof(tmp)))
+ if (argc > 1)
{
- info_level = (uint32)strtol(tmp, (char**)NULL, 10);
+ info_level = (uint32)strtol(argv[1], (char**)NULL, 10);
}
DEBUG(4,("cmd_wks_query_info: server:%s info level: %d\n",