summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/shell.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-04-06 08:16:36 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-04-06 16:26:52 +0200
commit23426257c6de3c147381d602583fe55b5d5a5ffa (patch)
tree9cd94a307667507a033d886cf73bd7ae716257a2 /cpukit/libmisc/shell/shell.c
parentshell: Move rtems_shell_init_environment() call (diff)
downloadrtems-23426257c6de3c147381d602583fe55b5d5a5ffa.tar.bz2
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.
Diffstat (limited to '')
-rw-r--r--cpukit/libmisc/shell/shell.c25
1 files changed, 25 insertions, 0 deletions
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
)