summaryrefslogtreecommitdiffstats
path: root/cpukit/include
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/include
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 'cpukit/include')
-rw-r--r--cpukit/include/rtems/shell.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/cpukit/include/rtems/shell.h b/cpukit/include/rtems/shell.h
index 58d0c515b3..f8b677d5cd 100644
--- a/cpukit/include/rtems/shell.h
+++ b/cpukit/include/rtems/shell.h
@@ -254,6 +254,31 @@ bool rtems_shell_main_loop(
rtems_shell_env_t *rtems_shell_env
);
+/**
+ * @brief Runs the shell main loop.
+ *
+ * The caller shall initialize the shell environment. It is recommended that
+ * the caller duplicates the current shell environment using
+ * rtems_shell_dup_current_env() and then performs the required customization.
+ * Shell commands will use the stdin, stdout, and stderr file streams set up by
+ * the caller.
+ *
+ * @param interactive indicates if the shell main loop interfaces with an
+ * interactive user. For an interactive user, a welcome message using
+ * "/etc/motd" is presented and command prompt is displayed.
+ *
+ * @param[in, out] line_editor_output is the optional line editor output file
+ * stream. It may be NULL, to disable the line editor output.
+ *
+ * @return Returns true, if no error occurred and a shell exit was requested,
+ * otherwise false.
+ */
+bool rtems_shell_run_main_loop(
+ rtems_shell_env_t *shell_env,
+ bool interactive,
+ FILE *line_editor_output
+);
+
extern const rtems_shell_env_t rtems_global_shell_env;
rtems_shell_env_t *rtems_shell_get_current_env(void);