summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/cmds.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-03-12 16:20:07 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-03-12 16:20:07 +0000
commit9d7739369f7fd25ff316447b229b82469f35a042 (patch)
treec41cd031c8a6f202b75b8c219121b577dfbfdb24 /cpukit/libmisc/shell/cmds.c
parent2008-03-12 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-9d7739369f7fd25ff316447b229b82469f35a042.tar.bz2
2008-03-12 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/shell/cmds.c: Directly register the command structure to avoid unnecessary duplication of static strings. We know best this time.
Diffstat (limited to 'cpukit/libmisc/shell/cmds.c')
-rw-r--r--cpukit/libmisc/shell/cmds.c23
1 files changed, 20 insertions, 3 deletions
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 <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <rtems.h>
#include <rtems/monitor.h>
@@ -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;
}
}