From: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
To: zsh-workers@sunsite.auc.dk
Subject: Re: `typeset -U' and exported tied parameters
Date: Wed, 10 May 2000 20:07:55 +0100 [thread overview]
Message-ID: <E12pbpp-0006cE-00.2000-05-10-20-07-53@cmailg5.svr.pol.co.uk> (raw)
In-Reply-To: ""Bart Schaefer""'s message of "Wed, 10 May 2000 15:59:24 -0000." <1000510155924.ZM10248@candle.brasslantern.com>
"Bart Schaefer" wrote:
> Note that although `typeset -U' has changed both the array and the tied
> parameter, it has failed to update the exported copy of the tied parameter.
This is the easy fix. This is similar to the same problem with
lower/uppercasing of parameter. I didn't look further because we sort of
agreed that parameter getting and setting could do with a complete
rewrite. (The number of things we've agreed over the years could do with a
complete rewrite is large. It's an immensely satisfying and timesaving
thing to do. Unfortunately it doesn't get anything fixed.)
The change to uniqarray() is just because no-one was using the return
value.
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.14
diff -u -r1.14 builtin.c
--- Src/builtin.c 2000/05/05 07:42:36 1.14
+++ Src/builtin.c 2000/05/10 19:04:25
@@ -1607,11 +1607,20 @@
}
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. */
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.7
diff -u -r1.7 params.c
--- Src/params.c 2000/04/27 08:21:10 1.7
+++ Src/params.c 2000/05/10 19:04:35
@@ -2299,10 +2299,9 @@
}
/**/
-int
+void
uniqarray(char **x)
{
- int changes = 0;
char **t, **p = x;
if (!x || !*x)
@@ -2312,10 +2311,8 @@
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 @@
* do the replacing, since we've already scanned for the string. */
/**/
-static void
+void
arrfixenv(char *s, char **t)
{
char **ep, *u;
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@CambridgeSiliconRadio.com
Web: http://www.pwstephenson.fsnet.co.uk
next prev parent reply other threads:[~2000-05-10 19:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-10 15:59 Bart Schaefer
2000-05-10 16:58 ` FUNCTIONS_INSTALL in Makefile's is not updated Andrej Borsenkow
2000-05-10 18:02 ` Bart Schaefer
2000-05-10 17:14 ` "Cancel" menu selection & Co? Andrej Borsenkow
2000-05-10 18:24 ` Bart Schaefer
2000-05-10 17:35 ` FPATH non-bug (Re: `typeset -U' and exported tied parameters) Bart Schaefer
2000-05-10 19:07 ` Peter Stephenson [this message]
2000-05-10 22:56 `typeset -U' and exported tied parameters Oliver Kiddle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E12pbpp-0006cE-00.2000-05-10-20-07-53@cmailg5.svr.pol.co.uk \
--to=pws@pwstephenson.fsnet.co.uk \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).