Changeset 26e04e2f in rtems


Ignore:
Timestamp:
Dec 12, 2014, 8:42:07 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
25e5f61
Parents:
7bdb765
git-author:
Sebastian Huber <sebastian.huber@…> (12/12/14 08:42:07)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/12/14 12:16:28)
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/shell/main_help.c

    r7bdb765 r26e04e2f  
    8888  char* lines_env;
    8989  rtems_shell_topic_t *topic;
    90   rtems_shell_cmd_t * shell_cmd = rtems_shell_first_cmd;
    9190
    9291  lines_env = getenv("SHELL_LINES");
     
    9998    printf("help: The topics are\n");
    10099    topic = rtems_shell_first_topic;
    101     col = 0;
     100    col = printf("  all");
    102101    while (topic) {
    103102      if (!col){
     
    118117  line = 0;
    119118  for (arg = 1;arg<argc;arg++) {
     119    const char *cur = argv[arg];
     120    rtems_shell_cmd_t *shell_cmd;
     121
    120122    if (lines && (line > lines)) {
    121123      printf("Press any key to continue...");getchar();
     
    123125      line = 0;
    124126    }
    125     topic  =  rtems_shell_lookup_topic(argv[arg]);
    126     if (!topic){
    127       if ((shell_cmd = rtems_shell_lookup_cmd(argv[arg])) == NULL) {
    128         printf("help: topic or cmd '%s' not found. Try <help> alone for a list\n",
    129             argv[arg]);
    130         line++;
     127    topic  =  rtems_shell_lookup_topic(cur);
     128    if (topic == NULL) {
     129      if ((shell_cmd = rtems_shell_lookup_cmd(cur)) == NULL) {
     130        if (strcmp(cur, "all") != 0) {
     131          printf(
     132            "help: topic or cmd '%s' not found. Try <help> alone for a list\n",
     133            cur
     134          );
     135          line++;
     136          continue;
     137        }
    131138      } else {
    132139        line+= rtems_shell_help_cmd(shell_cmd);
     140        continue;
    133141      }
    134       continue;
    135142    }
    136     printf("help: list for the topic '%s'\n",argv[arg]);
     143    printf("help: list for the topic '%s'\n",cur);
    137144    line++;
     145    shell_cmd = rtems_shell_first_cmd;
    138146    while (shell_cmd) {
    139       if (!strcmp(topic->topic,shell_cmd->topic))
     147      if (topic == NULL || !strcmp(topic->topic,shell_cmd->topic))
    140148        line+= rtems_shell_help_cmd(shell_cmd);
    141149      if (lines && (line > lines)) {
Note: See TracChangeset for help on using the changeset viewer.