diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-11-18 08:29:36 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-11-18 08:29:36 +0000 |
commit | 85f9fc6ccbc56c4224aba5691ddf913cffa886a7 (patch) | |
tree | bede7a2a9a2493d6270c5e79c83852fcd82432ac /usr.bin | |
parent | b35de996e97878b59d04658758823f3c4327a104 (diff) |
Check all %if in the list when deciding whether to process an
assignment, not just the most recent.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/cmd-parse.y | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd-parse.y b/usr.bin/tmux/cmd-parse.y index 6565d2d2797..c519e22a52d 100644 --- a/usr.bin/tmux/cmd-parse.y +++ b/usr.bin/tmux/cmd-parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-parse.y,v 1.51 2024/08/04 09:42:23 nicm Exp $ */ +/* $OpenBSD: cmd-parse.y,v 1.52 2024/11/18 08:29:35 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -223,9 +223,16 @@ assignment : EQUALS { struct cmd_parse_state *ps = &parse_state; int flags = ps->input->flags; + int flag = 1; + struct cmd_parse_scope *scope; - if ((~flags & CMD_PARSE_PARSEONLY) && - (ps->scope == NULL || ps->scope->flag)) + if (ps->scope != NULL) { + flag = ps->scope->flag; + TAILQ_FOREACH(scope, &ps->stack, entry) + flag = flag && scope->flag; + } + + if ((~flags & CMD_PARSE_PARSEONLY) && flag) environ_put(global_environ, $1, 0); free($1); } @@ -234,9 +241,16 @@ hidden_assignment : HIDDEN EQUALS { struct cmd_parse_state *ps = &parse_state; int flags = ps->input->flags; + int flag = 1; + struct cmd_parse_scope *scope; - if ((~flags & CMD_PARSE_PARSEONLY) && - (ps->scope == NULL || ps->scope->flag)) + if (ps->scope != NULL) { + flag = ps->scope->flag; + TAILQ_FOREACH(scope, &ps->stack, entry) + flag = flag && scope->flag; + } + + if ((~flags & CMD_PARSE_PARSEONLY) && flag) environ_put(global_environ, $2, ENVIRON_HIDDEN); free($2); } |