1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 21:44:11 +01:00

make assignament to $nameddirs behave like hash -d (13095)

This commit is contained in:
Sven Wischnowsky 2000-10-30 08:19:44 +00:00
parent 00d4d5df69
commit fb6fd42e00
2 changed files with 23 additions and 9 deletions

@ -1,3 +1,8 @@
2000-10-30 Sven Wischnowsky <wischnow@zsh.org>
* 13095: Src/Modules/parameter.c: make assignament to $nameddirs
behave like hash -d
2000-10-25 Sven Wischnowsky <wischnow@zsh.org>
* users/3472: Completion/User/_rcs: use return value of _files,

@ -1399,11 +1399,15 @@ scanpmjobdirs(HashTable ht, ScanFunc func, int flags)
static void
setpmnameddir(Param pm, char *value)
{
if (!value || *value != '/')
zwarn("invalid value: %s", value, 0);
else
adduserdir(pm->nam, value, 0, 1);
zsfree(value);
if (!value)
zwarn("invalid value: ''", NULL, 0);
else {
Nameddir nd = (Nameddir) zcalloc(sizeof(*nd));
nd->flags = 0;
nd->dir = value;
nameddirtab->addnode(nameddirtab, ztrdup(pm->nam), nd);
}
}
/**/
@ -1444,10 +1448,15 @@ setpmnameddirs(Param pm, HashTable ht)
v.arr = NULL;
v.pm = (Param) hn;
if (!(val = getstrvalue(&v)) || *val != '/')
zwarn("invalid value: %s", val, 0);
else
adduserdir(hn->nam, val, 0, 1);
if (!(val = getstrvalue(&v)))
zwarn("invalid value: ''", NULL, 0);
else {
Nameddir nd = (Nameddir) zcalloc(sizeof(*nd));
nd->flags = 0;
nd->dir = ztrdup(val);
nameddirtab->addnode(nameddirtab, ztrdup(hn->nam), nd);
}
}
/* The INTERACTIVE stuff ensures that the dirs are not immediatly removed