summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/monitor/mon-monitor.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-19 14:59:35 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-19 14:59:35 +0000
commiteb961961837bd288fb57799c189326fc944047b5 (patch)
treee857eea22b553b5288811467a2089ab87ad368ad /cpukit/libmisc/monitor/mon-monitor.c
parent2008-12-18 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-eb961961837bd288fb57799c189326fc944047b5.tar.bz2
2008-12-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libblock/src/ide_part_table.c: Fixed NULL pointer access. * libmisc/monitor/mon-command.c, libmisc/monitor/mon-editor.c, libmisc/monitor/mon-monitor.c, libmisc/monitor/monitor.h, libmisc/shell/cmds.c: The list of registered monitor commands is now private and only accessible via a lookup and iterate function.
Diffstat (limited to 'cpukit/libmisc/monitor/mon-monitor.c')
-rw-r--r--cpukit/libmisc/monitor/mon-monitor.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/cpukit/libmisc/monitor/mon-monitor.c b/cpukit/libmisc/monitor/mon-monitor.c
index 06f72e0f04..f60c9a33ed 100644
--- a/cpukit/libmisc/monitor/mon-monitor.c
+++ b/cpukit/libmisc/monitor/mon-monitor.c
@@ -60,7 +60,7 @@ rtems_symbol_table_t *rtems_monitor_symbols;
* The top-level commands
*/
-const rtems_monitor_command_entry_t rtems_monitor_commands[] = {
+static const rtems_monitor_command_entry_t rtems_monitor_commands[] = {
{ "config",
"Show the system configuration.",
0,
@@ -480,3 +480,27 @@ rtems_monitor_insert_cmd (
return 1;
}
+
+/**
+ * @brief Iterates through all registerd commands.
+ *
+ * For each command the interation routine @a routine is called with the
+ * command entry and the user provided argument @a arg. It is guaranteed that
+ * the command name and function are not NULL.
+ */
+void rtems_monitor_command_iterate(
+ rtems_monitor_per_command_routine routine,
+ void *arg
+)
+{
+ const rtems_monitor_command_entry_t *e = rtems_monitor_registered_commands;
+
+ while (e != NULL) {
+ if (e->command != NULL && e->command_function != NULL) {
+ if (!routine(e, arg)) {
+ break;
+ }
+ }
+ e = e->next;
+ }
+}