forked from Imagelibrary/rtems
shell: Add 'all' topic for help for all commands
This commit is contained in:
@@ -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...");
|
||||
|
||||
Reference in New Issue
Block a user