diff options
author | Thomas Adam <thomas@xteddy.org> | 2021-08-25 12:01:11 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2021-08-25 12:01:11 +0100 |
commit | c6375a0d4003d1008bb64e96e9c0c4433e4a5d13 (patch) | |
tree | ac84b463df1f905b68cfce14c68a1bfe3d543b05 /cmd.c | |
parent | 6616b42b2c28cd7a1b6d52dfc895f5a1d3dce8b3 (diff) | |
parent | 24636be42b4b0463afe5c72e1d982f28729a0579 (diff) | |
download | rtmux-c6375a0d4003d1008bb64e96e9c0c4433e4a5d13.tar.gz rtmux-c6375a0d4003d1008bb64e96e9c0c4433e4a5d13.tar.bz2 rtmux-c6375a0d4003d1008bb64e96e9c0c4433e4a5d13.zip |
Merge branch 'obsd-master' into master
Diffstat (limited to 'cmd.c')
-rw-r--r-- | cmd.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -501,6 +501,7 @@ cmd_parse(struct args_value *values, u_int count, const char *file, u_int line, const struct cmd_entry *entry; struct cmd *cmd; struct args *args; + char *error; if (count == 0 || values[0].type != ARGS_STRING) { xasprintf(cause, "no command"); @@ -510,11 +511,16 @@ cmd_parse(struct args_value *values, u_int count, const char *file, u_int line, if (entry == NULL) return (NULL); - args = args_parse(&entry->args, values, count); - if (args == NULL) { + args = args_parse(&entry->args, values, count, &error); + if (args == NULL && error == NULL) { 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); + } cmd = xcalloc(1, sizeof *cmd); cmd->entry = entry; |