diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-12-12 09:42:07 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-12-12 13:16:28 +0100 |
commit | 26e04e2f0201487fac3a1beece62292349b7d183 (patch) | |
tree | cf98b01c4e8fbd7c478e5bc67d7a7695176b6103 /cpukit/libmisc/shell/main_help.c | |
parent | Add POSIX key value pairs to resource snapshot (diff) | |
download | rtems-26e04e2f0201487fac3a1beece62292349b7d183.tar.bz2 |
shell: Add 'all' topic for help for all commands
Diffstat (limited to '')
-rw-r--r-- | cpukit/libmisc/shell/main_help.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/cpukit/libmisc/shell/main_help.c b/cpukit/libmisc/shell/main_help.c index 43701d916a..e45e7f8791 100644 --- a/cpukit/libmisc/shell/main_help.c +++ b/cpukit/libmisc/shell/main_help.c @@ -87,7 +87,6 @@ static int rtems_shell_help( int col,line,lines,arg; char* lines_env; rtems_shell_topic_t *topic; - rtems_shell_cmd_t * shell_cmd = rtems_shell_first_cmd; lines_env = getenv("SHELL_LINES"); if (lines_env) @@ -98,7 +97,7 @@ static int rtems_shell_help( if (argc<2) { printf("help: The topics are\n"); topic = rtems_shell_first_topic; - col = 0; + col = printf(" all"); while (topic) { if (!col){ col = printf(" %s",topic->topic); @@ -117,26 +116,35 @@ static int rtems_shell_help( } line = 0; for (arg = 1;arg<argc;arg++) { + const char *cur = argv[arg]; + rtems_shell_cmd_t *shell_cmd; + if (lines && (line > lines)) { printf("Press any key to continue...");getchar(); printf("\n"); line = 0; } - topic = rtems_shell_lookup_topic(argv[arg]); - if (!topic){ - if ((shell_cmd = rtems_shell_lookup_cmd(argv[arg])) == NULL) { - printf("help: topic or cmd '%s' not found. Try <help> alone for a list\n", - argv[arg]); - line++; + topic = rtems_shell_lookup_topic(cur); + if (topic == NULL) { + if ((shell_cmd = rtems_shell_lookup_cmd(cur)) == NULL) { + if (strcmp(cur, "all") != 0) { + printf( + "help: topic or cmd '%s' not found. Try <help> alone for a list\n", + cur + ); + line++; + continue; + } } else { line+= rtems_shell_help_cmd(shell_cmd); + continue; } - continue; } - printf("help: list for the topic '%s'\n",argv[arg]); + printf("help: list for the topic '%s'\n",cur); line++; + shell_cmd = rtems_shell_first_cmd; while (shell_cmd) { - if (!strcmp(topic->topic,shell_cmd->topic)) + if (topic == NULL || !strcmp(topic->topic,shell_cmd->topic)) line+= rtems_shell_help_cmd(shell_cmd); if (lines && (line > lines)) { printf("Press any key to continue..."); |