diff options
author | Gerald Carter <jerry@samba.org> | 2000-07-21 20:01:20 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2000-07-21 20:01:20 +0000 |
commit | a0e8a55c279af50c1f770c7b913262094b9b593a (patch) | |
tree | ddec8577b40101b78781e5cf5a3f3b23fd00072b /source/lib/cmd_interp.c | |
parent | 56ce247977c05ef37888c2572e679c44346e5568 (diff) | |
download | samba-a0e8a55c279af50c1f770c7b913262094b9b593a.tar.gz samba-a0e8a55c279af50c1f770c7b913262094b9b593a.tar.xz samba-a0e8a55c279af50c1f770c7b913262094b9b593a.zip |
Added EnumPorts() and fixed up some problems
with the other spoolss client calls.
Also cleaned up output for 'help' command.
jerry
Diffstat (limited to 'source/lib/cmd_interp.c')
-rw-r--r-- | source/lib/cmd_interp.c | 75 |
1 files changed, 27 insertions, 48 deletions
diff --git a/source/lib/cmd_interp.c b/source/lib/cmd_interp.c index 201a2443859..a9a1ad0e6b6 100644 --- a/source/lib/cmd_interp.c +++ b/source/lib/cmd_interp.c @@ -117,7 +117,7 @@ static uint32 num_commands = 0; ****************************************************************************/ void add_command_set(const struct command_set *cmds) { - while (cmds->fn != NULL) + while (! ((cmds->fn==NULL) && (strlen(cmds->name)==0))) { add_cmd_set_to_array(&num_commands, &commands, cmds); cmds++; @@ -132,16 +132,14 @@ static struct command_set general_commands[] = { * maintenance */ - { - "set", - cmd_set, + {"General", NULL, NULL, {NULL, NULL}}, + + { "set", cmd_set, "run rpcclient inside rpcclient (change options etc.)", {NULL, NULL} }, - { - "use", - cmd_use, + { "use", cmd_use, "net use and net view", {NULL, NULL} }, @@ -150,27 +148,19 @@ static struct command_set general_commands[] = { * bye bye */ - { - "quit", - cmd_quit, + { "quit", cmd_quit, "logoff the server", {NULL, NULL} }, - { - "q", - cmd_quit, + { "q", cmd_quit, "logoff the server", {NULL, NULL} }, - { - "exit", - cmd_quit, + { "exit", cmd_quit, "logoff the server", {NULL, NULL} }, - { - "bye", - cmd_quit, + { "bye", cmd_quit, "logoff the server", {NULL, NULL} }, @@ -179,15 +169,11 @@ static struct command_set general_commands[] = { * eek! */ - { - "help", - cmd_help, + { "help", cmd_help, "[command] give help on a command", {NULL, NULL} }, - { - "?", - cmd_help, + { "?", cmd_help, "[command] give help on a command", {NULL, NULL} }, @@ -196,9 +182,7 @@ static struct command_set general_commands[] = { * shell */ - { - "!", - NULL, + { "!", NULL, "run a shell command on the local system", {NULL, NULL} }, @@ -207,10 +191,7 @@ static struct command_set general_commands[] = { * oop! */ - { - "", - NULL, - NULL, + { "", NULL, NULL, {NULL, NULL} } }; @@ -242,31 +223,29 @@ static uint32 cmd_help(struct client_info *info, int argc, char *argv[]) { int i = 0, j = 0; - if (argc > 1) + /* get help on a specific command */ + if (argc > 0) { if ((i = process_tok(argv[1])) >= 0) { fprintf(out_hnd, "HELP %s:\n\t%s\n\n", commands[i]->name, commands[i]->description); } + + return 0; } - else + + /* Print out the list of available commands */ + for (i = 0; i < num_commands; i++) { - for (i = 0; i < num_commands; i++) - { - fprintf(out_hnd, "%-15s", commands[i]->name); - j++; - if (j == 5) - { - fprintf(out_hnd, "\n"); - j = 0; - } - } - if (j != 0) - { - fprintf(out_hnd, "\n"); - } + if (commands[i]->fn == NULL) + fprintf (out_hnd, "\n"); + else + fprintf (out_hnd, "\t"); + + fprintf(out_hnd, "%s\n", commands[i]->name); } + return 0; } |