From f624d6f3aef760f16570e030966eb4dc07fd81ec Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 2 Apr 2002 23:28:40 +0000 Subject: added "list " command to display the available commands one a single pipe (This used to be commit b73a8416d31c0ec7975ba022f5c425a581497b72) --- source3/rpcclient/rpcclient.c | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'source3') diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 3c8ede6966..ac5b38ee13 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -240,6 +240,50 @@ void fetch_machine_sid(struct cli_state *cli) exit(1); } +/* List the available commands on a given pipe */ + +static NTSTATUS cmd_listcommands(struct cli_state *cli, TALLOC_CTX *mem_ctx, + int argc, char **argv) +{ + struct cmd_list *tmp; + struct cmd_set *tmp_set; + int i; + + /* Usage */ + + if (argc != 2) { + printf("Usage: %s \n", argv[0]); + return NT_STATUS_OK; + } + + /* Help on one command */ + + for (tmp = cmd_list; tmp; tmp = tmp->next) + { + tmp_set = tmp->cmd_set; + + if (!StrCaseCmp(argv[1], tmp_set->name)) + { + printf("Available commands on the %s pipe:\n\n", tmp_set->name); + + i = 0; + tmp_set++; + while(tmp_set->name) { + printf("%20s", tmp_set->name); + tmp_set++; + i++; + if (i%4 == 0) + printf("\n"); + } + + /* drop out of the loop */ + break; + } + } + printf("\n\n"); + + return NT_STATUS_OK; +} /* Display help on commands */ @@ -336,6 +380,7 @@ static struct cmd_set rpcclient_commands[] = { { "help", cmd_help, NULL, "Get help on commands", "[command]" }, { "?", cmd_help, NULL, "Get help on commands", "[command]" }, { "debuglevel", cmd_debuglevel, NULL, "Set debug level", "level" }, + { "list", cmd_listcommands, NULL, "List available commands on ", "pipe" }, { "exit", cmd_quit, NULL, "Exit program", "" }, { "quit", cmd_quit, NULL, "Exit program", "" }, -- cgit