shell: Add 'all' topic for help for all commands

This commit is contained in:
Sebastian Huber
2014-12-12 09:42:07 +01:00
parent 7bdb765a67
commit 26e04e2f02

View File

@@ -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...");