[rtems commit] shell: Add and use SHELL_MAGIC

Sebastian Huber sebh at rtems.org
Thu Apr 7 05:47:56 UTC 2022


Module:    rtems
Branch:    master
Commit:    3407a3b1bcc2f673165e129bb1e44f9ca94a268f
Changeset: http://git.rtems.org/rtems/commit/?id=3407a3b1bcc2f673165e129bb1e44f9ca94a268f

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Apr  6 08:36:06 2022 +0200

shell: Add and use SHELL_MAGIC

---

 cpukit/libmisc/shell/shell.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 994c2ec6e9..090277c57c 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -49,8 +49,10 @@
 #define shell_std_debug(...)
 #endif
 
+#define SHELL_MAGIC rtems_build_name('S', 'E', 'N', 'V')
+
 const rtems_shell_env_t rtems_global_shell_env = {
-  .magic         = rtems_build_name('S', 'E', 'N', 'V'),
+  .magic         = SHELL_MAGIC,
   .managed       = false,
   .devname       = CONSOLE_DEVICE_NAME,
   .taskname      = "RTSH",
@@ -1020,7 +1022,7 @@ bool rtems_shell_main_loop(
 
   rtems_shell_init_environment();
 
-  if (shell_env->magic != rtems_build_name('S', 'E', 'N', 'V')) {
+  if (shell_env->magic != SHELL_MAGIC) {
     rtems_error(0, "invalid shell environment passed to the main loop)");
     return false;
   }
@@ -1171,7 +1173,7 @@ static rtems_status_code rtems_shell_run (
     name = rtems_build_name(
       task_name[0], task_name[1], task_name[2], task_name[3]);
   else
-    name = rtems_build_name( 'S', 'E', 'N', 'V' );
+    name = SHELL_MAGIC;
 
   sc = rtems_task_create(
     name,



More information about the vc mailing list