diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-12-17 22:30:24 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-02-27 20:08:09 +0100 |
commit | d59925b8fb67b5e01412279a23794a0926259d5b (patch) | |
tree | 4d42d0339da0d4086c6f9cac9c9f84f1729b1baa /common/command.c | |
parent | 5c50423b7011346c4a38309d82394e6a2d3cdf29 (diff) | |
download | barebox-d59925b8fb67b5e01412279a23794a0926259d5b.tar.gz barebox-d59925b8fb67b5e01412279a23794a0926259d5b.tar.xz |
command: do not allow abbreviated commands anymore
abbreviated commands are derived from U-Boot and are only
partly useful. Noone expects from a shell to support this,
also we have tab completion. They also have some funny
side effects. For example we have a 'time' command. If this
command is not compiled in, the time command is interpreted
as an abbreviated version of the 'timeout' command. So remove
support for abbreviated commands and safe the binary space.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/command.c')
-rw-r--r-- | common/command.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/common/command.c b/common/command.c index de2c3a9cdf..c9bab2a47c 100644 --- a/common/command.c +++ b/common/command.c @@ -159,26 +159,10 @@ EXPORT_SYMBOL(register_command); struct command *find_cmd (const char *cmd) { struct command *cmdtp; - struct command *cmdtp_temp = &__barebox_cmd_start; /*Init value */ - int len; - int n_found = 0; - len = strlen (cmd); - cmdtp = list_entry(&command_list, struct command, list); - - for_each_command(cmdtp) { - if (strncmp (cmd, cmdtp->name, len) == 0) { - if (len == strlen (cmdtp->name)) - return cmdtp; /* full match */ - - cmdtp_temp = cmdtp; /* abbreviated command ? */ - n_found++; - } - } - - if (n_found == 1) { /* exactly one match */ - return cmdtp_temp; - } + for_each_command(cmdtp) + if (!strcmp(cmd, cmdtp->name)) + return cmdtp; return NULL; /* not found or ambiguous command */ } |