1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 00:51:05 +02:00

Fix, test and comment unsetting and resetting of special tied parameters

This commit is contained in:
Peter Stephenson 2001-05-19 23:47:58 +00:00
parent fbe51d3ee9
commit 6ea2dab092
3 changed files with 37 additions and 1 deletions

View file

@ -632,7 +632,17 @@ The version number of this zsh.
enditem() enditem()
texinode(Parameters Used By The Shell)()(Parameters Set By The Shell)(Parameters) texinode(Parameters Used By The Shell)()(Parameters Set By The Shell)(Parameters)
sect(Parameters Used By The Shell) sect(Parameters Used By The Shell)
The following parameters are used by the shell: The following parameters are used by the shell.
In cases where there are two parameters with an upper- and lowercase
form of the same name, such as tt(path) and tt(PATH), the lowercase form
is an array and the uppercase form is a scalar with the elements of the
array joined together by colons. These are similar to tied parameters
created via `tt(typeset -T)'. The normal use for the colon-separated
form is for exporting to the environment, while the array form is easier
to manipulate within the shell. Note that unsetting either of the pair
will unset the other; they retain their special properties when
recreated, and recreating one of the pair will recreate the other.
startitem() startitem()
vindex(ARGV0) vindex(ARGV0)

View file

@ -669,6 +669,12 @@ createparam(char *name, int flags)
if (oldpm && (oldpm->level == locallevel || !(flags & PM_LOCAL))) { if (oldpm && (oldpm->level == locallevel || !(flags & PM_LOCAL))) {
if (!(oldpm->flags & PM_UNSET) || (oldpm->flags & PM_SPECIAL)) { if (!(oldpm->flags & PM_UNSET) || (oldpm->flags & PM_SPECIAL)) {
oldpm->flags &= ~PM_UNSET; oldpm->flags &= ~PM_UNSET;
if ((oldpm->flags & PM_SPECIAL) && oldpm->ename) {
Param altpm =
(Param) paramtab->getnode(paramtab, oldpm->ename);
if (altpm)
altpm->flags &= ~PM_UNSET;
}
return NULL; return NULL;
} }
if ((oldpm->flags & PM_RESTRICTED) && isset(RESTRICTED)) { if ((oldpm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {

View file

@ -526,3 +526,23 @@
>fixed >fixed
>the >the
>shell >shell
unset SHLVL
(( SHLVL++ ))
print $SHLVL
0:Unsetting and recreation of numerical special parameters
>1
unset manpath
print $+MANPATH
manpath=(/here /there)
print $MANPATH
unset MANPATH
print $+manpath
MANPATH=/elsewhere:/somewhere
print $manpath
0:Unsetting and recreation of tied special parameters
>0
>/here:/there
>0
>/elsewhere /somewhere