diff options
author | James Peach <jpeach@samba.org> | 2010-03-21 22:04:37 -0700 |
---|---|---|
committer | James Peach <jpeach@apple.com> | 2010-06-21 08:58:10 -0700 |
commit | 7a25e2efe9360b333fedc3fb938774437703700e (patch) | |
tree | ddaa6b7d1359f75e0cb25cafc2edce0fd27d385f | |
parent | bf35aa86038aa5bbf06bf73eb58cfa6fa1eae904 (diff) | |
download | samba-7a25e2efe9360b333fedc3fb938774437703700e.tar.gz samba-7a25e2efe9360b333fedc3fb938774437703700e.tar.bz2 samba-7a25e2efe9360b333fedc3fb938774437703700e.zip |
smbtorture: Enhance shell "help" command.
Sort the command list alphabetically. Let the help command print
usage info for other commands.
-rw-r--r-- | source4/torture/shell.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/source4/torture/shell.c b/source4/torture/shell.c index a0f9d7d3a3..888097de7f 100644 --- a/source4/torture/shell.c +++ b/source4/torture/shell.c @@ -58,13 +58,14 @@ struct shell_command static const struct shell_command commands[] = { { - shell_help, "help", NULL, - "print this help message" + shell_auth, "auth", + "[[username | principal | domain | realm | password] STRING]", + "set authentication parameters" }, { - shell_quit, "quit", NULL, - "exit smbtorture" + shell_help, "help", NULL, + "print this help message" }, { @@ -73,8 +74,8 @@ static const struct shell_command commands[] = }, { - shell_set, "set", "[NAME VALUE]", - "print or set test configuration parameters" + shell_quit, "quit", NULL, + "exit smbtorture" }, { @@ -83,10 +84,10 @@ static const struct shell_command commands[] = }, { - shell_auth, "auth", - "[[username | principal | domain | realm | password] STRING]", - "set authentication parameters" + shell_set, "set", "[NAME VALUE]", + "print or set test configuration parameters" } + }; void torture_shell(struct torture_context *tctx) @@ -147,10 +148,19 @@ static void shell_help(const struct shell_command * command, { int i; - fprintf(stdout, "Available commands:\n"); - for (i = 0; i < ARRAY_SIZE(commands); i++) { - fprintf(stdout, "\t%s - %s\n", - commands[i].name, commands[i].help); + if (argc == 1) { + for (i = 0; i < ARRAY_SIZE(commands); i++) { + if (match_command(argv[0], &commands[i])) { + shell_usage(&commands[i]); + return; + } + } + } else { + fprintf(stdout, "Available commands:\n"); + for (i = 0; i < ARRAY_SIZE(commands); i++) { + fprintf(stdout, "\t%s - %s\n", + commands[i].name, commands[i].help); + } } } |