* Small problem with typeset -U.
@ 1996-07-12 13:01 Andrej Borsenkow
1996-07-12 13:07 ` Andrej Borsenkow
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Andrej Borsenkow @ 1996-07-12 13:01 UTC (permalink / raw)
To: Zsh workers mailing list
Hi!
A little problem with mirror parameters (like path and PATH) and typeset
-U command.
If I set -U option for one of pair of mirrored parameters, it is not set
for other. Thus, e.g.
typeset -U path
PATH=$PATH:~/bin:~/bin
still results in ~/bin being in path/PATH two times. The same holds also
if I set -U for path and try to change PATH.
It is true for any set of mirrored parameters.
I have a small patch for zsh-3.0-pre2, which (I hope;) corrects it. It
checks, wether parameter is special, and wether it has counterpart; if
yes, it sets PM_UNIQUE for it also. It is probably incomplete (it does
nothing if counterpart doesn't exist - should it be considered an error?)
but as far as I can tell, it works in more logical way.
I think, that it would be better solved by adding one more flag (say,
PM_MIRRORED). It would provide for creating arbitrary user defined paires
of mirrored parameters. Alas! I am not so deep in zsh as to dare to write
it. I will sometime do - or is it already implemented in some other way?
Please, Cc any replies to my address.
thanks
greetings
-------------------------------------------------------------------------
Andrej Borsenkow Fax: +7 (095) 252 01 05
SNI ITS Moscow Tel: +7 (095) 252 13 88
NERV: borsenkow.msk E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------
===============================================
2801a2802,2811
> if ((pm->flags & PM_SPECIAL) && pm->ename) {
> Param pme;
>
> pme = (Param) paramtab->getnode(paramtab, pm->ename);
> if (pme)
> if (on & PM_UNIQUE)
> pme->flags |= PM_UNIQUE;
> else
> pme->flags &= ~PM_UNIQUE;
> };
2870a2881,2890
> if ((pm->flags & PM_SPECIAL) && pm->ename) {
> Param pme;
>
> pme = (Param) paramtab->getnode(paramtab, pm->ename);
> if (pme)
> if (on & PM_UNIQUE)
> pme->flags |= PM_UNIQUE;
> else
> pme->flags &= ~PM_UNIQUE;
> };
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small problem with typeset -U.
1996-07-12 13:01 Small problem with typeset -U Andrej Borsenkow
@ 1996-07-12 13:07 ` Andrej Borsenkow
1996-07-12 15:41 ` Zoltan Hidvegi
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 1996-07-12 13:07 UTC (permalink / raw)
To: Zsh workers mailing list
Sorry, just found, that it was not the best diff format. Once more ;)
-------------------------------------------------------------------------
Andrej Borsenkow Fax: +7 (095) 252 01 05
SNI ITS Moscow Tel: +7 (095) 252 13 88
NERV: borsenkow.msk E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------
==========================================================
--- Src/builtin.c.org Thu Jul 4 20:05:16 1996
+++ Src/builtin.c Fri Jul 12 16:38:49 1996
@@ -2799,6 +2799,16 @@
!(pm->flags & PM_READONLY & ~off))
uniqarray((*pm->gets.afn) (pm));
pm->flags = (pm->flags | on) & ~off;
+ if ((pm->flags & PM_SPECIAL) && pm->ename) {
+ Param pme;
+
+ pme = (Param) paramtab->getnode(paramtab, pm->ename);
+ if (pme)
+ if (on & PM_UNIQUE)
+ pme->flags |= PM_UNIQUE;
+ else
+ pme->flags &= ~PM_UNIQUE;
+ };
if (PM_TYPE(pm->flags) != PM_ARRAY) {
if (on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER))
pm->ct = auxlen;
@@ -2868,6 +2878,16 @@
!(pm->flags & PM_READONLY & ~off))
uniqarray((*pm->gets.afn) (pm));
pm->flags = (pm->flags | on) & ~off;
+ if ((pm->flags & PM_SPECIAL) && pm->ename) {
+ Param pme;
+
+ pme = (Param) paramtab->getnode(paramtab, pm->ename);
+ if (pme)
+ if (on & PM_UNIQUE)
+ pme->flags |= PM_UNIQUE;
+ else
+ pme->flags &= ~PM_UNIQUE;
+ };
if (on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER))
pm->ct = auxlen;
if (PM_TYPE(pm->flags) != PM_ARRAY) {
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small problem with typeset -U.
1996-07-12 13:01 Small problem with typeset -U Andrej Borsenkow
1996-07-12 13:07 ` Andrej Borsenkow
@ 1996-07-12 15:41 ` Zoltan Hidvegi
1996-07-12 15:48 ` Zefram
1996-07-12 15:48 ` Bart Schaefer
3 siblings, 0 replies; 5+ messages in thread
From: Zoltan Hidvegi @ 1996-07-12 15:41 UTC (permalink / raw)
To: borsenkow.msk; +Cc: zsh-workers
> Hi!
>
> A little problem with mirror parameters (like path and PATH) and typeset
> -U command.
>
> If I set -U option for one of pair of mirrored parameters, it is not set
> for other. Thus, e.g.
>
> typeset -U path
> PATH=$PATH:~/bin:~/bin
>
> still results in ~/bin being in path/PATH two times. The same holds also
> if I set -U for path and try to change PATH.
This behaviour is deliberate since it gives more flexibility to the shell.
As I remember when I originally introduced it others agreed that this is
useful.
Zoltan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small problem with typeset -U.
1996-07-12 13:01 Small problem with typeset -U Andrej Borsenkow
1996-07-12 13:07 ` Andrej Borsenkow
1996-07-12 15:41 ` Zoltan Hidvegi
@ 1996-07-12 15:48 ` Zefram
1996-07-12 15:48 ` Bart Schaefer
3 siblings, 0 replies; 5+ messages in thread
From: Zefram @ 1996-07-12 15:48 UTC (permalink / raw)
To: borsenkow.msk; +Cc: zsh-workers
>If I set -U option for one of pair of mirrored parameters, it is not set
>for other. Thus, e.g.
I believe that's deliberate. It gives $PATH the proper Bourne shell
behaviour, and $path the behaviour csh was intended to have. The
distinction is quite useful, and uniqing $PATH would break a lot of
scripts.
-zefram
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small problem with typeset -U.
1996-07-12 13:01 Small problem with typeset -U Andrej Borsenkow
` (2 preceding siblings ...)
1996-07-12 15:48 ` Zefram
@ 1996-07-12 15:48 ` Bart Schaefer
3 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 1996-07-12 15:48 UTC (permalink / raw)
To: Zsh workers mailing list, borsenkow.msk
On Jul 12, 5:01pm, Andrej Borsenkow wrote:
} Subject: Small problem with typeset -U.
}
} A little problem with mirror parameters (like path and PATH) and typeset
} -U command.
}
} If I set -U option for one of pair of mirrored parameters, it is not set
} for other.
}
} I have a small patch for zsh-3.0-pre2, which (I hope;) corrects it. It
} checks, wether parameter is special, and wether it has counterpart; if
} yes, it sets PM_UNIQUE for it also.
Why limit it to PM_UNIQUE? Surely there are other flags etc. that should
be mirrored along with the values ... `integer', for example ... but then
there are some, such as `exported', that should not be mirrored ... hmm.
} I think, that it would be better solved by adding one more flag (say,
} PM_MIRRORED). It would provide for creating arbitrary user defined paires
} of mirrored parameters.
This would be great; however, we'd also need flags for PM_COLONARRAY to
identify arrays that should be colon-separated, and maybe a flag for
variables that should never become unset.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1996-07-12 15:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-12 13:01 Small problem with typeset -U Andrej Borsenkow
1996-07-12 13:07 ` Andrej Borsenkow
1996-07-12 15:41 ` Zoltan Hidvegi
1996-07-12 15:48 ` Zefram
1996-07-12 15:48 ` Bart Schaefer
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).