summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/shell.c
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-08-14 14:50:55 +1000
committerChris Johns <chrisj@rtems.org>2017-08-23 09:48:56 +1000
commit89fd08eae6d3801a917daccc992b0ac5b32cf4d6 (patch)
tree7ade1a054dda8a10d6397bc154cb88ec27444215 /cpukit/libmisc/shell/shell.c
parentconfdefs: Fix POSIX keys configuration (diff)
downloadrtems-89fd08eae6d3801a917daccc992b0ac5b32cf4d6.tar.bz2
libmisc/shell: Make some internal shell functions public.
- Add 'rtems_shell_init_environment()' so a user can create the shell environment without needing to run a shell. - Move 'rtems_shell_lookup_topic', 'rtems_shell_can_see_cmd', and 'rtems_shell_execute_cmd' from the internal interface to the public interface. Closes #3104.
Diffstat (limited to 'cpukit/libmisc/shell/shell.c')
-rw-r--r--cpukit/libmisc/shell/shell.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index e7e57933a0..5f042f5855 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -147,6 +147,12 @@ static void rtems_shell_init_once(void)
"running on %m\n");
rtems_shell_init_commands();
+ rtems_shell_register_monitor_commands();
+}
+
+void rtems_shell_init_environment(void)
+{
+ assert(pthread_once(&rtems_shell_once, rtems_shell_init_once) == 0);
}
/*
@@ -721,10 +727,7 @@ bool rtems_shell_main_loop(
FILE *stdinToClose = NULL;
FILE *stdoutToClose = NULL;
- eno = pthread_once(&rtems_shell_once, rtems_shell_init_once);
- assert(eno == 0);
-
- rtems_shell_register_monitor_commands();
+ rtems_shell_init_environment();
shell_env = rtems_shell_init_env(shell_env_arg);
if (shell_env == NULL) {