summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-04-05 16:47:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-04-06 16:26:52 +0200
commite765cfb450f35cef6ec73dafd2c956fa21bc3df7 (patch)
tree577ba7e561820d8a10e05c3c42a80894fa997291 /cpukit/libmisc/shell
parentshell: Refactor rtems_shell_main_loop() (diff)
downloadrtems-e765cfb450f35cef6ec73dafd2c956fa21bc3df7.tar.bz2
shell: Simplify rtems_shell_dup_current_env()
Do not assign members already provided by the global environment.
Diffstat (limited to 'cpukit/libmisc/shell')
-rw-r--r--cpukit/libmisc/shell/shell.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index a85ca58dec..994c2ec6e9 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -53,7 +53,7 @@ const rtems_shell_env_t rtems_global_shell_env = {
.magic = rtems_build_name('S', 'E', 'N', 'V'),
.managed = false,
.devname = CONSOLE_DEVICE_NAME,
- .taskname = "SHGL",
+ .taskname = "RTSH",
.exit_shell = false,
.forever = true,
.echo = false,
@@ -267,12 +267,13 @@ void rtems_shell_dup_current_env(rtems_shell_env_t *copy)
if (env != NULL) {
shell_std_debug("dup: existing parent\n");
*copy = *env;
- }
- else {
+
+ /*
+ * Duplicated environments are not managed.
+ */
+ copy->managed = false;
+ } else {
*copy = rtems_global_shell_env;
- copy->magic = rtems_build_name('S', 'E', 'N', 'V');
- copy->devname = CONSOLE_DEVICE_NAME;
- copy->taskname = "RTSH";
copy->parent_stdout = stdout;
copy->parent_stdin = stdin;
copy->parent_stderr = stderr;
@@ -281,10 +282,6 @@ void rtems_shell_dup_current_env(rtems_shell_env_t *copy)
fileno(copy->parent_stdout), copy->parent_stdout,
fileno(copy->parent_stdin), copy->parent_stdin);
}
- /*
- * Duplicated environments are not managed.
- */
- copy->managed = false;
}
/*