diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2022-04-11 00:18:04 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2022-04-11 00:18:04 +0200 |
commit | 31bcc5c263aea983e967426e2b94269e7605dcd4 (patch) | |
tree | 7b48ad9d7799afe09b7d7d8adc980bd5db935bdf /Src/Modules/param_private.c | |
parent | 5086b5356abcef8849dc8a09902b7c55f01db3c0 (diff) | |
parent | b09f4483416c54c1782824633dfabaf2ec0265b6 (diff) | |
download | zsh-31bcc5c263aea983e967426e2b94269e7605dcd4.tar.gz zsh-31bcc5c263aea983e967426e2b94269e7605dcd4.zip |
Update upstream source from tag 'upstream/5.8.1.2-test'
Update to upstream version '5.8.1.2-test'
with Debian dir b380d582bf51cd93149e4dea28fffa1ad85db4f5
Diffstat (limited to 'Src/Modules/param_private.c')
-rw-r--r-- | Src/Modules/param_private.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Src/Modules/param_private.c b/Src/Modules/param_private.c index 86416c5c5..c53839152 100644 --- a/Src/Modules/param_private.c +++ b/Src/Modules/param_private.c @@ -125,7 +125,7 @@ makeprivate(HashNode hn, UNUSED(int flags)) break; } /* PM_HIDE so new parameters in deeper scopes do not shadow */ - pm->node.flags |= (PM_HIDE|PM_SPECIAL|PM_REMOVABLE); + pm->node.flags |= (PM_HIDE|PM_SPECIAL|PM_REMOVABLE|PM_RO_BY_DESIGN); pm->level -= 1; } } @@ -171,6 +171,7 @@ bin_private(char *nam, char **args, LinkList assigns, Options ops, int func) { int from_typeset = 1; int ofake = fakelevel; /* paranoia in case of recursive call */ + int hasargs = /* *args != NULL || */ (assigns && firstnode(assigns)); makeprivate_error = 0; if (!OPT_ISSET(ops, 'P')) { @@ -189,7 +190,12 @@ bin_private(char *nam, char **args, LinkList assigns, Options ops, int func) return bin_typeset("private", args, assigns, ops, func); } - ops->ind['g'] = 2; /* force bin_typeset() to behave as "local" */ + if (!(OPT_ISSET(ops, 'm') || OPT_ISSET(ops, '+'))) + ops->ind['g'] = 2; /* force bin_typeset() to behave as "local" */ + if (OPT_ISSET(ops, 'p') || OPT_ISSET(ops, 'm') || + (!hasargs && OPT_ISSET(ops, '+'))) { + return bin_typeset("private", args, assigns, ops, func); + } queue_signals(); fakelevel = locallevel; @@ -555,7 +561,7 @@ printprivatenode(HashNode hn, int printflags) static struct builtin bintab[] = { /* Copied from BUILTIN("local"), "P" added */ - BUILTIN("private", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_private, 0, -1, 0, "AE:%F:%HL:%PR:%TUZ:%ahi:%lprtux", "P") + BUILTIN("private", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_private, 0, -1, 0, "AE:%F:%HL:%PR:%TUZ:%ahi:%lmprtux", "P") }; static struct features module_features = { |