1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-17 15:01:40 +02:00

11314: fix for typeset -U not updating value in environment

This commit is contained in:
Peter Stephenson 2000-05-10 19:15:58 +00:00
parent 94a6e3c227
commit ade3663216
3 changed files with 21 additions and 10 deletions

View file

@ -1,3 +1,8 @@
2000-05-10 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
* 11314: Src/builtin.c, Src/params.c: typeset -Uing tied variables
didn't update the value in the environment.
2000-05-10 Bart Schaefer <schaefer@zsh.org> 2000-05-10 Bart Schaefer <schaefer@zsh.org>
* 11312: Config/config.mk: defs.mk depends on config.status. * 11312: Config/config.mk: defs.mk depends on config.status.

View file

@ -1607,11 +1607,20 @@ typeset_single(char *cname, char *pname, Param pm, int func,
} }
if ((on & PM_UNIQUE) && !(pm->flags & PM_READONLY & ~off)) { if ((on & PM_UNIQUE) && !(pm->flags & PM_READONLY & ~off)) {
Param apm; Param apm;
if (PM_TYPE(pm->flags) == PM_ARRAY) char **x;
uniqarray((*pm->gets.afn) (pm)); if (PM_TYPE(pm->flags) == PM_ARRAY) {
else if (PM_TYPE(pm->flags) == PM_SCALAR && pm->ename && x = (*pm->gets.afn)(pm);
(apm = (Param) paramtab->getnode(paramtab, pm->ename))) uniqarray(x);
uniqarray((*apm->gets.afn) (apm)); if (pm->ename && x)
arrfixenv(pm->ename, x);
} else if (PM_TYPE(pm->flags) == PM_SCALAR && pm->ename &&
(apm =
(Param) paramtab->getnode(paramtab, pm->ename))) {
x = (*apm->gets.afn)(apm);
uniqarray(x);
if (x)
arrfixenv(pm->nam, x);
}
} }
pm->flags = (pm->flags | on) & ~(off | PM_UNSET); pm->flags = (pm->flags | on) & ~(off | PM_UNSET);
/* This auxlen/pm->ct stuff is a nasty hack. */ /* This auxlen/pm->ct stuff is a nasty hack. */

View file

@ -2299,10 +2299,9 @@ colonarrsetfn(Param pm, char *x)
} }
/**/ /**/
int void
uniqarray(char **x) uniqarray(char **x)
{ {
int changes = 0;
char **t, **p = x; char **t, **p = x;
if (!x || !*x) if (!x || !*x)
@ -2312,10 +2311,8 @@ uniqarray(char **x)
if (!strcmp(*p, *t)) { if (!strcmp(*p, *t)) {
zsfree(*p); zsfree(*p);
for (t = p--; (*t = t[1]) != NULL; t++); for (t = p--; (*t = t[1]) != NULL; t++);
changes++;
break; break;
} }
return changes;
} }
/* Function to get value of special parameter `#' and `ARGC' */ /* Function to get value of special parameter `#' and `ARGC' */
@ -2759,7 +2756,7 @@ pipestatsetfn(Param pm, char **x)
* do the replacing, since we've already scanned for the string. */ * do the replacing, since we've already scanned for the string. */
/**/ /**/
static void void
arrfixenv(char *s, char **t) arrfixenv(char *s, char **t)
{ {
char **ep, *u; char **ep, *u;