summaryrefslogtreecommitdiffstats
path: root/common/command.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-08-10 12:40:01 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-08-10 20:59:55 +0200
commit16edced39ecf4c316179b72c01af249f85b36218 (patch)
tree6f11dee57e63318e6100e2f0b43a9c3b1b771c4b /common/command.c
parent58713d32746d49ad39ba17658fe82f1b98b80b2e (diff)
downloadbarebox-16edced39ecf4c316179b72c01af249f85b36218.tar.gz
barebox-16edced39ecf4c316179b72c01af249f85b36218.tar.xz
hush: Make exit a shell builtin
'exit' used to do its job by returning value < 0. This is a sign for hush that 'exit' is executed. This has problems: - Often commands accidently return a negative value. This causes the shell to exit. - execute_binfmt returns a negative value when it does not find a binary to execute. This again causes the shell to exit. Returning a negative error value seems to be the right thing to do, but catching this in the shell would mean that the exit command does not work anymore. - if called without arguments exit is supposed to return the code of the last command. As a command exit has no access to this code. This patch changes exit to be a builtin and also fixes the last return code problem. While at it, update the help text. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/command.c')
-rw-r--r--common/command.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/common/command.c b/common/command.c
index c18998c129..2bfc5117e8 100644
--- a/common/command.c
+++ b/common/command.c
@@ -38,26 +38,6 @@
LIST_HEAD(command_list);
EXPORT_SYMBOL(command_list);
-#ifdef CONFIG_SHELL_HUSH
-
-static int do_exit(int argc, char *argv[])
-{
- int r;
-
- r = 0;
- if (argc > 1)
- r = simple_strtoul(argv[1], NULL, 0);
-
- return -r - 2;
-}
-
-BAREBOX_CMD_START(exit)
- .cmd = do_exit,
- .usage = "exit script",
-BAREBOX_CMD_END
-
-#endif
-
void barebox_cmd_usage(struct command *cmdtp)
{
#ifdef CONFIG_LONGHELP