version 1.170, 2021/08/21 18:39:07 |
version 1.171, 2021/08/25 08:51:55 |
|
|
const struct cmd_entry *entry; |
const struct cmd_entry *entry; |
struct cmd *cmd; |
struct cmd *cmd; |
struct args *args; |
struct args *args; |
|
char *error; |
|
|
if (count == 0 || values[0].type != ARGS_STRING) { |
if (count == 0 || values[0].type != ARGS_STRING) { |
xasprintf(cause, "no command"); |
xasprintf(cause, "no command"); |
|
|
if (entry == NULL) |
if (entry == NULL) |
return (NULL); |
return (NULL); |
|
|
args = args_parse(&entry->args, values, count); |
args = args_parse(&entry->args, values, count, &error); |
if (args == NULL) { |
if (args == NULL && error == NULL) { |
xasprintf(cause, "usage: %s %s", entry->name, entry->usage); |
xasprintf(cause, "usage: %s %s", entry->name, entry->usage); |
|
return (NULL); |
|
} |
|
if (args == NULL) { |
|
xasprintf(cause, "command %s: %s", entry->name, error); |
|
free(error); |
return (NULL); |
return (NULL); |
} |
} |
|
|