[PATCH 4/6] shell: Add and use SHELL_MAGIC

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Apr 6 07:17:30 UTC 2022


---
 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 278c3dc0ae..9bb143dd29 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,
-- 
2.34.1



More information about the devel mailing list