From 23426257c6de3c147381d602583fe55b5d5a5ffa Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 6 Apr 2022 08:16:36 +0200 Subject: shell: Add rtems_shell_run_main_loop() In contrast to rtems_shell_main_loop(), this new function does not perform all sorts of initialization based on environment settings. For example, due to the use of isatty() in rtems_shell_main_loop() it is impossible to run an interactive shell through a socket connection. --- cpukit/libmisc/shell/shell.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'cpukit/libmisc/shell/shell.c') diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c index c00883ba66..64f90be121 100644 --- a/cpukit/libmisc/shell/shell.c +++ b/cpukit/libmisc/shell/shell.c @@ -1010,6 +1010,31 @@ static bool shell_main_loop( return result; } +bool rtems_shell_run_main_loop( + rtems_shell_env_t *shell_env, + bool interactive, + FILE *line_editor_output +) +{ + bool result; + + if (shell_env->magic != SHELL_MAGIC) { + return false; + } + + if (!rtems_shell_init_user_env()) { + return false; + } + + if (!rtems_shell_set_shell_env(shell_env)) { + return false; + } + + result = shell_main_loop(shell_env, interactive, line_editor_output); + rtems_shell_clear_shell_env(); + return result; +} + bool rtems_shell_main_loop( rtems_shell_env_t *shell_env ) -- cgit v1.2.3