summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/shell_cmdset.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-11-18 10:36:27 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-11-20 10:30:25 +0100
commit5c141d6a25d7b389a1fa75a94f14ad8a68b587ed (patch)
tree9cae890947a7a49081dcfaae7b803b2dcae2c9db /cpukit/libmisc/shell/shell_cmdset.c
parentshell: Make rtems_shell_main_joel() static (diff)
downloadrtems-5c141d6a25d7b389a1fa75a94f14ad8a68b587ed.tar.bz2
shell: Add and use rtems_shell_execute_cmd()
Diffstat (limited to '')
-rw-r--r--cpukit/libmisc/shell/shell_cmdset.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/cpukit/libmisc/shell/shell_cmdset.c b/cpukit/libmisc/shell/shell_cmdset.c
index 2f2c246429..07d37dbda7 100644
--- a/cpukit/libmisc/shell/shell_cmdset.c
+++ b/cpukit/libmisc/shell/shell_cmdset.c
@@ -214,3 +214,20 @@ rtems_shell_cmd_t *rtems_shell_alias_cmd(
}
return shell_aux;
}
+
+int rtems_shell_execute_cmd(const char *cmd, int argc, char *argv[])
+{
+ rtems_shell_cmd_t *shell_cmd;
+
+ if (argv[0] == NULL) {
+ return -1;
+ }
+
+ shell_cmd = rtems_shell_lookup_cmd(argv[0]);
+
+ if (shell_cmd == NULL) {
+ return rtems_shell_script_file(argc, argv);
+ } else {
+ return shell_cmd->command(argc, argv);
+ }
+}