mirror of
https://github.com/tmux/tmux.git
synced 2026-10-07 02:04:22 +00:00
Do not count arguments starting - as optional arguments, makes old
resize-pane syntax work. GitHub issue 5275, based on a changed from Dane Jensen.
This commit is contained in:
14
arguments.c
14
arguments.c
@@ -149,7 +149,7 @@ args_parse_flag_argument(struct args_value *values, u_int count, char **cause,
|
||||
int optional_argument)
|
||||
{
|
||||
struct args_value *argument, *new;
|
||||
const char *s;
|
||||
const char *s, *as;
|
||||
|
||||
new = xcalloc(1, sizeof *new);
|
||||
if (*string != '\0') {
|
||||
@@ -180,12 +180,24 @@ args_parse_flag_argument(struct args_value *values, u_int count, char **cause,
|
||||
xasprintf(cause, "-%c expects an argument", flag);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (optional_argument && argument->type == ARGS_STRING) {
|
||||
as = argument->string;
|
||||
if (as[0] == '-' && (as[1] == '-' || isalpha((u_char)as[1]))) {
|
||||
args_free_value(new);
|
||||
free(new);
|
||||
log_debug("%s: -%c (optional)", __func__, flag);
|
||||
args_set(args, flag, NULL, ARGS_ENTRY_OPTIONAL_VALUE);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
args_copy_value(new, argument);
|
||||
(*i)++;
|
||||
|
||||
out:
|
||||
s = args_value_as_string(new);
|
||||
log_debug("%s: -%c = %s", __func__, flag, s);
|
||||
|
||||
args_set(args, flag, new, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user