From 9d7739369f7fd25ff316447b229b82469f35a042 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 12 Mar 2008 16:20:07 +0000 Subject: 2008-03-12 Joel Sherrill * libmisc/shell/cmds.c: Directly register the command structure to avoid unnecessary duplication of static strings. We know best this time. --- cpukit/libmisc/shell/cmds.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'cpukit/libmisc/shell/cmds.c') diff --git a/cpukit/libmisc/shell/cmds.c b/cpukit/libmisc/shell/cmds.c index 8a351bb00c..aa63a46a3b 100644 --- a/cpukit/libmisc/shell/cmds.c +++ b/cpukit/libmisc/shell/cmds.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -40,12 +41,28 @@ int rtems_shell_main_monitor(int argc,char * argv[]) { void rtems_shell_register_monitor_commands(void) { rtems_monitor_command_entry_t *command; + /* monitor topic */ command = rtems_monitor_commands; + while (command) { - if (strcmp("exit",command->command)) /* Exclude EXIT (alias quit)*/ - rtems_shell_add_cmd(command->command,"monitor", - command->usage,rtems_shell_main_monitor); + /* Exclude EXIT (alias quit)*/ + if (strcmp("exit",command->command)) { + rtems_shell_cmd_t *shell_cmd; + + shell_cmd = (rtems_shell_cmd_t *) malloc(sizeof(rtems_shell_cmd_t)); + shell_cmd->name = command->command; + shell_cmd->topic = "monitor"; + shell_cmd->usage = command->usage; + shell_cmd->command = rtems_shell_main_monitor; + shell_cmd->alias = (rtems_shell_cmd_t *) NULL; + shell_cmd->next = (rtems_shell_cmd_t *) NULL; + + if (rtems_shell_add_cmd_struct( shell_cmd ) == NULL) { + free( shell_cmd ); + shell_cmd = NULL; + } + } command = command->next; } } -- cgit v1.2.3