summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/command.c8
-rw-r--r--include/command.h4
2 files changed, 11 insertions, 1 deletions
diff --git a/common/command.c b/common/command.c
index 24c2e2407f..52b9ee14ef 100644
--- a/common/command.c
+++ b/common/command.c
@@ -94,6 +94,7 @@ static int compare(struct list_head *a, struct list_head *b)
int execute_command(int argc, char **argv)
{
cmd_tbl_t *cmdtp;
+ int ret;
/* Look up command in command table */
if ((cmdtp = find_cmd(argv[0]))) {
@@ -103,7 +104,12 @@ int execute_command(int argc, char **argv)
return -1;
}
/* OK - call function to do the command */
- return cmdtp->cmd(cmdtp, argc, argv);
+ ret = cmdtp->cmd(cmdtp, argc, argv);
+ if (ret == COMMAND_ERROR_USAGE) {
+ u_boot_cmd_usage(cmdtp);
+ return COMMAND_ERROR;
+ }
+ return ret;
} else {
printf ("Unknown command '%s' - try 'help'\n", argv[0]);
return -1; /* give up after bad command */
diff --git a/include/command.h b/include/command.h
index aaae6b4309..5d57ecdeb5 100644
--- a/include/command.h
+++ b/include/command.h
@@ -74,6 +74,10 @@ cmd_tbl_t *find_cmd(const char *cmd);
int execute_command(int argc, char **argv);
void u_boot_cmd_usage(cmd_tbl_t *cmdtp);
+#define COMMAND_SUCCESS 0
+#define COMMAND_ERROR 1
+#define COMMAND_ERROR_USAGE 2
+
#endif /* __ASSEMBLY__ */
/*