shell: Rename HALT to SHUTDOWN command

Use a normal command for shutdown via exit().
This commit is contained in:
Sebastian Huber
2014-11-17 15:42:57 +01:00
parent e02d5dd9b3
commit bac3d6df35
4 changed files with 23 additions and 36 deletions

View File

@@ -19,20 +19,21 @@
#include <rtems/shell.h> #include <rtems/shell.h>
#include "internal.h" #include "internal.h"
static int rtems_shell_main_halt( static int rtems_shell_main_shutdown(
int argc __attribute__((unused)), int argc __attribute__((unused)),
char *argv[] __attribute__((unused)) char *argv[] __attribute__((unused))
) )
{ {
fprintf(stdout, "System shutting down at user request\n");
exit(0); exit(0);
return 0; return 0;
} }
rtems_shell_cmd_t rtems_shell_HALT_Command = { rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command = {
"halt", /* name */ "shutdown", /* name */
"halt", /* usage */ "shutdown", /* usage */
"rtems", /* topic */ "rtems", /* topic */
rtems_shell_main_halt, /* command */ rtems_shell_main_shutdown, /* command */
NULL, /* alias */ NULL, /* alias */
NULL /* next */ NULL /* next */
}; };

View File

@@ -891,9 +891,6 @@ bool rtems_shell_main_loop(
if (!strcmp(cmds[cmd],"bye") || !strcmp(cmds[cmd],"exit")) { if (!strcmp(cmds[cmd],"bye") || !strcmp(cmds[cmd],"exit")) {
fprintf(stdout, "Shell exiting\n" ); fprintf(stdout, "Shell exiting\n" );
break; break;
} else if (!strcmp(cmds[cmd],"shutdown")) { /* exit application */
fprintf(stdout, "System shutting down at user request\n" );
exit(0);
} }
/* exec cmd section */ /* exec cmd section */

View File

@@ -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_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_CPUUSE_Command;
extern rtems_shell_cmd_t rtems_shell_TOP_Command; extern rtems_shell_cmd_t rtems_shell_TOP_Command;
extern rtems_shell_cmd_t rtems_shell_STACKUSE_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 * RTEMS Related commands
*/ */
#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \
!defined(CONFIGURE_SHELL_NO_COMMAND_HALT)) || \ !defined(CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN)) || \
defined(CONFIGURE_SHELL_COMMAND_HALT) defined(CONFIGURE_SHELL_COMMAND_SHUTDOWN)
&rtems_shell_HALT_Command, &rtems_shell_SHUTDOWN_Command,
#endif #endif
#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \
!defined(CONFIGURE_SHELL_NO_COMMAND_CPUUSE)) || \ !defined(CONFIGURE_SHELL_NO_COMMAND_CPUUSE)) || \

View File

@@ -11,7 +11,7 @@ The RTEMS shell has the following rtems commands:
@itemize @bullet @itemize @bullet
@item @code{halt} - Shutdown the system @item @code{shutdown} - Shutdown the system
@item @code{cpuuse} - print or reset per thread cpu usage @item @code{cpuuse} - print or reset per thread cpu usage
@item @code{stackuse} - print per thread stack usage @item @code{stackuse} - print per thread stack usage
@item @code{perioduse} - print or reset per period usage @item @code{perioduse} - print or reset per period usage
@@ -42,14 +42,14 @@ command as well as providing an example usage.
@c @c
@c @c
@page @page
@subsection halt - Shutdown the system @subsection shutdown - Shutdown the system
@pgindex halt @pgindex shutdown
@subheading SYNOPSYS: @subheading SYNOPSYS:
@example @example
halt shutdown
@end example @end example
@subheading DESCRIPTION: @subheading DESCRIPTION:
@@ -65,10 +65,11 @@ This command does not return.
@subheading EXAMPLES: @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 @example
SHLL [/] $ halt SHLL [/] $ shutdown
System shutting down at user request
@end example @end example
The user will not see another prompt and the system will The user will not see another prompt and the system will
@@ -76,37 +77,25 @@ shutdown.
@subheading CONFIGURATION: @subheading CONFIGURATION:
@findex CONFIGURE_SHELL_NO_COMMAND_HALT @findex CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN
@findex CONFIGURE_SHELL_COMMAND_HALT @findex CONFIGURE_SHELL_COMMAND_SHUTDOWN
This command is included in the default shell command set. This command is included in the default shell command set.
When building a custom command set, define When building a custom command set, define
@code{CONFIGURE_SHELL_COMMAND_HALT} to have this @code{CONFIGURE_SHELL_COMMAND_SHUTDOWN} to have this
command included. command included.
This command can be excluded from the shell command set by 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. shell commands have been configured.
@subheading PROGRAMMING INFORMATION: @subheading PROGRAMMING INFORMATION:
@findex rtems_shell_rtems_main_halt The configuration structure for the @code{shutdown} has the
The @code{halt} is implemented by a C language function
which has the following prototype:
@example
int rtems_shell_rtems_main_halt(
int argc,
char **argv
);
@end example
The configuration structure for the @code{halt} has the
following prototype: following prototype:
@example @example
extern rtems_shell_cmd_t rtems_shell_HALT_Command; extern rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command;
@end example @end example
@c @c