diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2005-08-08 16:48:52 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2005-08-08 16:48:52 +0000 |
commit | d307660deeb115dd2061654c2ddcd4407cadb04c (patch) | |
tree | 5ee4d623c09b60695a8567ea22f2756c7685cdf3 /Src/exec.c | |
parent | d7902f6badcc63cb76f3534cf542c4bd8889a18a (diff) | |
download | zsh-d307660deeb115dd2061654c2ddcd4407cadb04c.tar.gz zsh-d307660deeb115dd2061654c2ddcd4407cadb04c.tar.xz zsh-d307660deeb115dd2061654c2ddcd4407cadb04c.zip |
21575 plus unposted: Add WARN_CREATE_GLOBAL option
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Src/exec.c b/Src/exec.c index 515a41f9b..39308b121 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1649,10 +1649,14 @@ addvars(Estate state, Wordcode pc, int export) LinkList vl; int xtr, isstr, htok = 0; char **arr, **ptr, *name; + int flags, augment; + Wordcode opc = state->pc; wordcode ac; local_list1(svl); + flags = (locallevel > 0 && isset(WARNCREATEGLOBAL)) ? + ASSPM_WARN_CREATE : 0; xtr = isset(XTRACE); if (xtr) { printprompt4(); @@ -1660,12 +1664,15 @@ addvars(Estate state, Wordcode pc, int export) } state->pc = pc; while (wc_code(ac = *state->pc++) == WC_ASSIGN) { + int myflags = flags; name = ecgetstr(state, EC_DUPTOK, &htok); if (htok) untokenize(name); + if (WC_ASSIGN_TYPE2(ac) == WC_ASSIGN_INC) + myflags |= ASSPM_AUGMENT; if (xtr) fprintf(xtrerr, - WC_ASSIGN_TYPE2(ac) == WC_ASSIGN_INC ? "%s+=" : "%s=", name); + WC_ASSIGN_TYPE2(ac) == WC_ASSIGN_INC ? "%s+=" : "%s=", name); if ((isstr = (WC_ASSIGN_TYPE(ac) == WC_ASSIGN_SCALAR))) { init_list1(svl, ecgetstr(state, EC_DUPTOK, &htok)); vl = &svl; @@ -1716,12 +1723,10 @@ addvars(Estate state, Wordcode pc, int export) } allexp = opts[ALLEXPORT]; opts[ALLEXPORT] = 1; - pm = assignsparam(name, val, - WC_ASSIGN_TYPE2(ac) == WC_ASSIGN_INC); + pm = assignsparam(name, val, myflags); opts[ALLEXPORT] = allexp; } else - pm = assignsparam(name, val, - WC_ASSIGN_TYPE2(ac) == WC_ASSIGN_INC); + pm = assignsparam(name, val, myflags); if (errflag) { state->pc = opc; return; @@ -1746,7 +1751,7 @@ addvars(Estate state, Wordcode pc, int export) } fprintf(xtrerr, ") "); } - assignaparam(name, arr, WC_ASSIGN_TYPE2(ac) == WC_ASSIGN_INC); + assignaparam(name, arr, myflags); if (errflag) { state->pc = opc; return; |