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 #3096.
This commit is contained in:
Chris Johns
2017-08-14 14:50:55 +10:00
parent 0daa8ab825
commit 2465c0130b
3 changed files with 35 additions and 19 deletions

View File

@@ -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) {