1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-22 11:51:04 +02:00

keep association elements from being exported

This commit is contained in:
Sven Wischnowsky 2000-04-04 12:02:04 +00:00
parent c15ef20346
commit 8488dcb806
4 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,9 @@
2000-04-03 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
* 10463: Src/builtin.c, Src/params.c, Src/zsh.h: PM_HASHELEM
flag to keep association elements from being exported with
ALL_EXPORT set
* 10459: Completion/Commands/_next_tags, Doc/Zsh/compwid.yo,
Src/Zle/compcore.c: _next_tags should be usable with menu-
completion

View File

@ -1630,7 +1630,8 @@ typeset_single(char *cname, char *pname, Param pm, int func,
if (!(pm->flags & PM_UNSET) && !pm->env && !value)
pm->env = addenv(pname, getsparam(pname), pm->flags);
} else if (pm->env &&
(!pm->level || (isset(ALLEXPORT) && !pm->old))) {
(!pm->level || (isset(ALLEXPORT) && !pm->old &&
!(pm->flags & PM_HASHELEM)))) {
delenv(pm->env);
zsfree(pm->env);
pm->env = NULL;

View File

@ -617,6 +617,9 @@ createparam(char *name, int flags)
{
Param pm, oldpm;
if (paramtab != realparamtab)
flags = (flags & ~PM_EXPORTED) | PM_HASHELEM;
if (name != nulstring) {
oldpm = (Param) (paramtab == realparamtab ?
gethashnode2(paramtab, name) :
@ -646,7 +649,7 @@ createparam(char *name, int flags)
paramtab->addnode(paramtab, ztrdup(name), pm);
}
if (isset(ALLEXPORT) && !oldpm)
if (isset(ALLEXPORT) && !oldpm && !(flags & PM_HASHELEM))
flags |= PM_EXPORTED;
} else {
pm = (Param) zhalloc(sizeof *pm);
@ -1520,7 +1523,7 @@ setstrvalue(Value v, char *val)
break;
}
if ((!v->pm->env && !(v->pm->flags & PM_EXPORTED) &&
!(isset(ALLEXPORT) && !v->pm->old)) ||
!(isset(ALLEXPORT) && !v->pm->old && !(v->pm->flags & PM_HASHELEM))) ||
(v->pm->flags & PM_ARRAY) || v->pm->ename)
return;
if (PM_TYPE(v->pm->flags) == PM_INTEGER)
@ -2742,7 +2745,7 @@ arrfixenv(char *s, char **t)
*/
if (t == path)
cmdnamtab->emptytable(cmdnamtab);
if (isset(ALLEXPORT) ? !!pm->old : pm->level)
if ((pm->flags & PM_HASHELEM) || (isset(ALLEXPORT) ? !!pm->old : pm->level))
return;
u = t ? zjoin(t, ':', 1) : "";
len_s = strlen(s);

View File

@ -1125,6 +1125,7 @@ struct param {
#define PM_REMOVABLE (1<<21) /* special can be removed from paramtab */
#define PM_AUTOLOAD (1<<22) /* autoloaded from module */
#define PM_NORESTORE (1<<23) /* do not restore value of local special */
#define PM_HASHELEM (1<<24) /* is a hash-element */
/* The option string corresponds to the first of the variables above */
#define TYPESET_OPTSTR "aiEFALRZlurtxUhT"