summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-07-21 20:01:20 +0000
committerGerald Carter <jerry@samba.org>2000-07-21 20:01:20 +0000
commitfe245e2a92b47567ae1c8a27158e27ef360e0efc (patch)
tree21f15c71f9d510853556cdea674067f9c3e75e85
parent92708e3945cf294b3cb8d946200f8a7bf5d1def6 (diff)
downloadsamba-fe245e2a92b47567ae1c8a27158e27ef360e0efc.tar.gz
samba-fe245e2a92b47567ae1c8a27158e27ef360e0efc.tar.bz2
samba-fe245e2a92b47567ae1c8a27158e27ef360e0efc.zip
Added EnumPorts() and fixed up some problems
with the other spoolss client calls. Also cleaned up output for 'help' command. jerry (This used to be commit a0e8a55c279af50c1f770c7b913262094b9b593a)
-rw-r--r--source3/lib/cmd_interp.c75
1 files changed, 27 insertions, 48 deletions
diff --git a/source3/lib/cmd_interp.c b/source3/lib/cmd_interp.c
index 201a244385..a9a1ad0e6b 100644
--- a/source3/lib/cmd_interp.c
+++ b/source3/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;
}