mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
smbtorture: Enhance shell "help" command.
Sort the command list alphabetically. Let the help command print usage info for other commands.
This commit is contained in:
parent
bf35aa8603
commit
7a25e2efe9
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user