Keep -? as usage.
authornicm <nicm@openbsd.org>
Thu, 9 Sep 2021 21:55:03 +0000 (21:55 +0000)
committernicm <nicm@openbsd.org>
Thu, 9 Sep 2021 21:55:03 +0000 (21:55 +0000)
usr.bin/tmux/arguments.c
usr.bin/tmux/cmd.c

index 1b5ec3d..03a5b82 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: arguments.c,v 1.50 2021/09/09 13:38:32 nicm Exp $ */
+/* $OpenBSD: arguments.c,v 1.51 2021/09/09 21:55:03 nicm Exp $ */
 
 /*
  * Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -153,6 +153,10 @@ args_parse(const struct args_parse *parse, struct args_value *values,
                        flag = *string++;
                        if (flag == '\0')
                                break;
+                       if (flag == '?') {
+                               args_free(args);
+                               return (NULL);
+                       }
                        if (!isalnum(flag)) {
                                xasprintf(cause, "invalid flag -%c", flag);
                                args_free(args);
index 719dbdf..5245871 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.172 2021/08/27 17:25:55 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.173 2021/09/09 21:55:03 nicm Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -502,7 +502,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;
+       char                    *error = NULL;
 
        if (count == 0 || values[0].type != ARGS_STRING) {
                xasprintf(cause, "no command");