[PATCH 12/22] shell: Rename HALT to SHUTDOWN command

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Nov 18 14:37:18 UTC 2014


Use a normal command for shutdown via exit().
---
 cpukit/libmisc/shell/main_halt.c   | 11 ++++++-----
 cpukit/libmisc/shell/shell.c       |  3 ---
 cpukit/libmisc/shell/shellconfig.h |  8 ++++----
 doc/shell/rtems.t                  | 37 +++++++++++++------------------------
 4 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/cpukit/libmisc/shell/main_halt.c b/cpukit/libmisc/shell/main_halt.c
index 4db513d..a7a7d2d 100644
--- a/cpukit/libmisc/shell/main_halt.c
+++ b/cpukit/libmisc/shell/main_halt.c
@@ -19,20 +19,21 @@
 #include <rtems/shell.h>
 #include "internal.h"
 
-static int rtems_shell_main_halt(
+static int rtems_shell_main_shutdown(
   int   argc __attribute__((unused)),
   char *argv[] __attribute__((unused))
 )
 {
+  fprintf(stdout, "System shutting down at user request\n");
   exit(0);
   return 0;
 }
 
-rtems_shell_cmd_t rtems_shell_HALT_Command = {
-  "halt",                                    /* name */
-  "halt",                                    /* usage */
+rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command = {
+  "shutdown",                                /* name */
+  "shutdown",                                /* usage */
   "rtems",                                   /* topic */
-  rtems_shell_main_halt,                     /* command */
+  rtems_shell_main_shutdown,                 /* command */
   NULL,                                      /* alias */
   NULL                                       /* next */
 };
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 14edf52..9a5ffb5 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -891,9 +891,6 @@ bool rtems_shell_main_loop(
           if (!strcmp(cmds[cmd],"bye") || !strcmp(cmds[cmd],"exit")) {
             fprintf(stdout, "Shell exiting\n" );
             break;
-          } else if (!strcmp(cmds[cmd],"shutdown")) { /* exit application */
-            fprintf(stdout, "System shutting down at user request\n" );
-            exit(0);
           }
 
           /* exec cmd section */
diff --git a/cpukit/libmisc/shell/shellconfig.h b/cpukit/libmisc/shell/shellconfig.h
index e58916e..d9d6078 100644
--- a/cpukit/libmisc/shell/shellconfig.h
+++ b/cpukit/libmisc/shell/shellconfig.h
@@ -76,7 +76,7 @@ extern rtems_shell_cmd_t rtems_shell_MD5_Command;
 
 extern rtems_shell_cmd_t rtems_shell_RTC_Command;
 
-extern rtems_shell_cmd_t rtems_shell_HALT_Command;
+extern rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command;
 extern rtems_shell_cmd_t rtems_shell_CPUUSE_Command;
 extern rtems_shell_cmd_t rtems_shell_TOP_Command;
 extern rtems_shell_cmd_t rtems_shell_STACKUSE_Command;
@@ -400,9 +400,9 @@ extern rtems_shell_alias_t *rtems_shell_Initial_aliases[];
      *  RTEMS Related commands
      */
     #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \
-         !defined(CONFIGURE_SHELL_NO_COMMAND_HALT)) || \
-        defined(CONFIGURE_SHELL_COMMAND_HALT)
-      &rtems_shell_HALT_Command,
+         !defined(CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN)) || \
+        defined(CONFIGURE_SHELL_COMMAND_SHUTDOWN)
+      &rtems_shell_SHUTDOWN_Command,
     #endif
     #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \
          !defined(CONFIGURE_SHELL_NO_COMMAND_CPUUSE)) || \
diff --git a/doc/shell/rtems.t b/doc/shell/rtems.t
index 0661869..5ebead3 100644
--- a/doc/shell/rtems.t
+++ b/doc/shell/rtems.t
@@ -11,7 +11,7 @@ The RTEMS shell has the following rtems commands:
 
 @itemize @bullet
 
- at item @code{halt} - Shutdown the system
+ at item @code{shutdown} - Shutdown the system
 @item @code{cpuuse} - print or reset per thread cpu usage
 @item @code{stackuse} - print per thread stack usage
 @item @code{perioduse} - print or reset per period usage
@@ -42,14 +42,14 @@ command as well as providing an example usage.
 @c
 @c
 @page
- at subsection halt - Shutdown the system
+ at subsection shutdown - Shutdown the system
 
- at pgindex halt
+ at pgindex shutdown
 
 @subheading SYNOPSYS:
 
 @example
-halt
+shutdown
 @end example
 
 @subheading DESCRIPTION:
@@ -65,10 +65,11 @@ This command does not return.
 
 @subheading EXAMPLES:
 
-The following is an example of how to use @code{halt}:
+The following is an example of how to use @code{shutdown}:
 
 @example
-SHLL [/] $ halt
+SHLL [/] $ shutdown
+System shutting down at user request
 @end example
 
 The user will not see another prompt and the system will 
@@ -76,37 +77,25 @@ shutdown.
 
 @subheading CONFIGURATION:
 
- at findex CONFIGURE_SHELL_NO_COMMAND_HALT
- at findex CONFIGURE_SHELL_COMMAND_HALT
+ at findex CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN
+ at findex CONFIGURE_SHELL_COMMAND_SHUTDOWN
 
 This command is included in the default shell command set.  
 When building a custom command set, define
- at code{CONFIGURE_SHELL_COMMAND_HALT} to have this
+ at code{CONFIGURE_SHELL_COMMAND_SHUTDOWN} to have this
 command included.
 
 This command can be excluded from the shell command set by
-defining @code{CONFIGURE_SHELL_NO_COMMAND_HALT} when all
+defining @code{CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN} when all
 shell commands have been configured.
 
 @subheading PROGRAMMING INFORMATION:
 
- at findex rtems_shell_rtems_main_halt
-
-The @code{halt} is implemented by a C language function
-which has the following prototype:
-
- at example
-int rtems_shell_rtems_main_halt(
-  int    argc,
-  char **argv
-);
- at end example
-
-The configuration structure for the @code{halt} has the
+The configuration structure for the @code{shutdown} has the
 following prototype:
 
 @example
-extern rtems_shell_cmd_t rtems_shell_HALT_Command;
+extern rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command;
 @end example
 
 @c
-- 
1.8.4.5




More information about the devel mailing list