Fix number of command_names searched (fixes #18)

The "help" subcommand was removed in 6d1407b, but the number of commands
searched was not updated. With this commit it always checks the right
number of command strings.
pull/23/head
Christopher Wellons 2018-06-30 15:42:55 -04:00
parent a38e5e3bb9
commit f01f732433
1 changed files with 2 additions and 1 deletions

View File

@ -1129,8 +1129,9 @@ parse_command(char *command)
{
int found = COMMAND_UNKNOWN;
size_t len = strlen(command);
int ncommands = sizeof(command_names) / sizeof(*command_names);
int i;
for (i = 0; i < 5; i++) {
for (i = 0; i < ncommands; i++) {
if (strncmp(command, command_names[i], len) == 0) {
if (found >= 0)
return COMMAND_AMBIGUOUS;