summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2007-12-12 10:10:38 +0000
committerChris Johns <chrisj@rtems.org>2007-12-12 10:10:38 +0000
commit06bd7c74b111323995ebd9167f472b610e46b551 (patch)
tree77f3741e7208882f1e21484eca0dd103767f094c /cpukit
parent2007-12-11 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-06bd7c74b111323995ebd9167f472b610e46b551.tar.bz2
2007-12-12 Chris Johns <chrisj@rtems.org>
* Makefile.am: Added libmisc/shell/shellconfig.h to the installed header list. * libmisc/shell/shell_cmdset.c: Let the Initial command add occur in any order rather than before any commands have been added. Also made the command's strings be copies rather than references. * sapi/src/ioregisterdriver.c: Return the I/O initialise calls result.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog9
-rw-r--r--cpukit/Makefile.am2
-rw-r--r--cpukit/libmisc/shell/shell_cmdset.c29
-rw-r--r--cpukit/sapi/src/ioregisterdriver.c4
4 files changed, 30 insertions, 14 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index aedddb254f..7bc9aa7be6 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,12 @@
+2007-12-12 Chris Johns <chrisj@rtems.org>
+
+ * Makefile.am: Added libmisc/shell/shellconfig.h to the installed
+ header list.
+ * libmisc/shell/shell_cmdset.c: Let the Initial command add occur
+ in any order rather than before any commands have been added. Also
+ made the command's strings be copies rather than references.
+ * sapi/src/ioregisterdriver.c: Return the I/O initialise calls result.
+
2007-12-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, posix/Makefile.am, wrapup/Makefile.am:
diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 4a2abfadf4..8ab264a74a 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -114,7 +114,7 @@ include_rtems_HEADERS += libmisc/mw-fb/mw_fb.h libmisc/mw-fb/mw_uid.h
## shell
if LIBSHELL
-include_rtems_HEADERS += libmisc/shell/shell.h
+include_rtems_HEADERS += libmisc/shell/shell.h libmisc/shell/shellconfig.h
endif
## i2c
diff --git a/cpukit/libmisc/shell/shell_cmdset.c b/cpukit/libmisc/shell/shell_cmdset.c
index dddff4e8ad..daade2bb03 100644
--- a/cpukit/libmisc/shell/shell_cmdset.c
+++ b/cpukit/libmisc/shell/shell_cmdset.c
@@ -111,6 +111,13 @@ shell_cmd_t *shell_add_cmd_struct(
)
{
shell_cmd_t *shell_pvt;
+
+ shell_pvt = shell_first_cmd;
+ while (shell_pvt) {
+ if (strcmp(shell_pvt->name, shell_cmd->name) == 0)
+ return NULL;
+ shell_pvt = shell_pvt->next;
+ }
if ( !shell_first_cmd ) {
shell_first_cmd = shell_cmd;
@@ -135,25 +142,30 @@ shell_cmd_t * shell_add_cmd(
shell_command_t command
)
{
- extern void register_cmds(void);
-
shell_cmd_t *shell_cmd;
-
if (!cmd)
return (shell_cmd_t *) NULL;
if (!command)
return (shell_cmd_t *) NULL;
shell_cmd = (shell_cmd_t *) malloc(sizeof(shell_cmd_t));
- shell_cmd->name = cmd;
- shell_cmd->topic = topic;
- shell_cmd->usage = usage;
+ shell_cmd->name = strdup( cmd );
+ shell_cmd->topic = strdup( topic );
+ shell_cmd->usage = strdup( usage );
shell_cmd->command = command;
shell_cmd->alias = (shell_cmd_t *) NULL;
shell_cmd->next = (shell_cmd_t *) NULL;
- return shell_add_cmd_struct( shell_cmd );
+ if (shell_add_cmd_struct( shell_cmd ) == NULL) {
+ free( shell_cmd->usage );
+ free( shell_cmd->topic );
+ free( shell_cmd->name );
+ free( shell_cmd );
+ shell_cmd = NULL;
+ }
+
+ return shell_cmd;
}
@@ -162,9 +174,6 @@ void shell_initialize_command_set(void)
shell_cmd_t **c;
shell_alias_t **a;
- if ( shell_first_cmd )
- return;
-
for ( c = Shell_Initial_commands ; *c ; c++ ) {
shell_add_cmd_struct( *c );
}
diff --git a/cpukit/sapi/src/ioregisterdriver.c b/cpukit/sapi/src/ioregisterdriver.c
index 45d5ffe97b..4c57e3fbf7 100644
--- a/cpukit/sapi/src/ioregisterdriver.c
+++ b/cpukit/sapi/src/ioregisterdriver.c
@@ -88,7 +88,5 @@ rtems_status_code rtems_io_register_driver(
_IO_Driver_address_table[major] = *driver_table;
*registered_major = major;
- rtems_io_initialize( major, 0, NULL );
-
- return RTEMS_SUCCESSFUL;
+ return rtems_io_initialize( major, 0, NULL );
}