=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd.c,v retrieving revision 1.170 retrieving revision 1.171 diff -u -r1.170 -r1.171 --- src/usr.bin/tmux/cmd.c 2021/08/21 18:39:07 1.170 +++ src/usr.bin/tmux/cmd.c 2021/08/25 08:51:55 1.171 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.170 2021/08/21 18:39:07 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.171 2021/08/25 08:51:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -502,6 +502,7 @@ 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"); @@ -511,9 +512,14 @@ 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); }