summaryrefslogtreecommitdiffstats
path: root/common/parser.c
diff options
context:
space:
mode:
authorSascha Hauer <sha@pengutronix.de>2009-10-17 12:01:14 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-10-19 10:18:51 +0200
commitef7ff70ca445f380548fe17f488dc6428aa1efc5 (patch)
tree1a672d375d001ff844d979e79dbe93ec3c92e8e5 /common/parser.c
parent2dc2132f0e3c707a86fe332fd94b1c05b137dfe7 (diff)
downloadbarebox-ef7ff70ca445f380548fe17f488dc6428aa1efc5.tar.gz
consolidate command calling in execute_command
Signed-off-by: Sascha Hauer <sha@pengutronix.de>
Diffstat (limited to 'common/parser.c')
-rw-r--r--common/parser.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/common/parser.c b/common/parser.c
index c43d7ca..97e354b 100644
--- a/common/parser.c
+++ b/common/parser.c
@@ -176,7 +176,6 @@ static void process_macros (const char *input, char *output)
int run_command (const char *cmd, int flag)
{
- cmd_tbl_t *cmdtp;
char cmdbuf[CONFIG_CBSIZE]; /* working copy of cmd */
char *token; /* start of token in cmdbuf */
char *sep; /* end of token (separator) in cmdbuf */
@@ -251,23 +250,7 @@ int run_command (const char *cmd, int flag)
continue;
}
- /* Look up command in command table */
- if ((cmdtp = find_cmd(argv[0])) == NULL) {
- printf ("Unknown command '%s' - try 'help'\n", argv[0]);
- rc = -1; /* give up after bad command */
- continue;
- }
-
- /* found - check max args */
- if (argc > cmdtp->maxargs) {
- printf ("Usage:\n%s\n", cmdtp->usage);
- rc = -1;
- continue;
- }
-
- /* OK - call function to do the command */
- if ((cmdtp->cmd) (cmdtp, argc, argv) != 0)
- rc = -1;
+ rc = execute_command(argc, argv);
}
return rc;