diff options
-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); } |