diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2023-01-08 23:34:47 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2023-01-08 23:34:47 +0000 |
commit | 6e134a255d3c4c84b3932296427e49b67483ca41 (patch) | |
tree | 2b64625dc99fc38b334333f62681bf58cf83ceca /usr.bin/tmux/arguments.c | |
parent | 2dda5dde18a8af03be9a64c802a7486d5eb58056 (diff) |
Fix parsing of optional arguments so that and accept a - starting an
argument.
Diffstat (limited to 'usr.bin/tmux/arguments.c')
-rw-r--r-- | usr.bin/tmux/arguments.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c index 2a0d4ca2673..cffb6930a66 100644 --- a/usr.bin/tmux/arguments.c +++ b/usr.bin/tmux/arguments.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arguments.c,v 1.57 2022/12/16 08:13:40 nicm Exp $ */ +/* $OpenBSD: arguments.c,v 1.58 2023/01/08 23:34:46 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -150,8 +150,6 @@ args_parse_flag_argument(struct args_value *values, u_int count, char **cause, xasprintf(cause, "-%c argument must be a string", flag); return (-1); } - if (argument->string[0] == '-') - argument = NULL; } if (argument == NULL) { if (optional_argument) { @@ -210,12 +208,12 @@ args_parse_flags(const struct args_parse *parse, struct args_value *values, xasprintf(cause, "unknown flag -%c", flag); return (-1); } - if (*++found != ':') { + if (found[1] != ':') { log_debug("%s: -%c", __func__, flag); args_set(args, flag, NULL, 0); continue; } - optional_argument = (*found == ':'); + optional_argument = (found[2] == ':'); return (args_parse_flag_argument(values, count, cause, args, i, string, flag, optional_argument)); } |