about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c19
-rw-r--r--Src/params.c7
3 files changed, 21 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index df83a72b9..42cba68b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	* 11312: Config/config.mk: defs.mk depends on config.status.
diff --git a/Src/builtin.c b/Src/builtin.c
index 68155d2c6..b2f82803c 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1607,11 +1607,20 @@ typeset_single(char *cname, char *pname, Param pm, int func,
 	}
 	if ((on & PM_UNIQUE) && !(pm->flags & PM_READONLY & ~off)) {
 	    Param apm;
-	    if (PM_TYPE(pm->flags) == PM_ARRAY)
-		uniqarray((*pm->gets.afn) (pm));
-	    else if (PM_TYPE(pm->flags) == PM_SCALAR && pm->ename &&
-		     (apm = (Param) paramtab->getnode(paramtab, pm->ename)))
-		uniqarray((*apm->gets.afn) (apm));
+	    char **x;
+	    if (PM_TYPE(pm->flags) == PM_ARRAY) {
+		x = (*pm->gets.afn)(pm);
+		uniqarray(x);
+		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);
 	/* This auxlen/pm->ct stuff is a nasty hack. */
diff --git a/Src/params.c b/Src/params.c
index 74c4ee1c8..abdcd8e2e 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -2299,10 +2299,9 @@ colonarrsetfn(Param pm, char *x)
 }
 
 /**/
-int
+void
 uniqarray(char **x)
 {
-    int changes = 0;
     char **t, **p = x;
 
     if (!x || !*x)
@@ -2312,10 +2311,8 @@ uniqarray(char **x)
 	    if (!strcmp(*p, *t)) {
 		zsfree(*p);
 		for (t = p--; (*t = t[1]) != NULL; t++);
-		changes++;
 		break;
 	    }
-    return changes;
 }
 
 /* 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. */
 
 /**/
-static void
+void
 arrfixenv(char *s, char **t)
 {
     char **ep, *u;