summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-04-02 23:28:40 +0000
committerGerald Carter <jerry@samba.org>2002-04-02 23:28:40 +0000
commitf624d6f3aef760f16570e030966eb4dc07fd81ec (patch)
tree34fefb75ad65425436365070a229c4fc33361a91 /source3/rpcclient
parent87ea010ae14b2dc9a3e5b9d64ca9e63ec9de91f8 (diff)
downloadsamba-f624d6f3aef760f16570e030966eb4dc07fd81ec.tar.gz
samba-f624d6f3aef760f16570e030966eb4dc07fd81ec.tar.bz2
samba-f624d6f3aef760f16570e030966eb4dc07fd81ec.zip
added "list <pipe>" command to display the available commands
one a single pipe (This used to be commit b73a8416d31c0ec7975ba022f5c425a581497b72)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/rpcclient.c45
1 files changed, 45 insertions, 0 deletions
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 <pipe>\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>", "pipe" },
{ "exit", cmd_quit, NULL, "Exit program", "" },
{ "quit", cmd_quit, NULL, "Exit program", "" },