about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-10-30 08:19:44 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-10-30 08:19:44 +0000
commitfb6fd42e00879016660b4f68b0b10d7ff269ae05 (patch)
tree4682aad75c2b043edb7a6f77d6907a0e633bd508 /Src
parent00d4d5df69ed7aebbb576eb87dc16fc1c2aa2354 (diff)
downloadzsh-fb6fd42e00879016660b4f68b0b10d7ff269ae05.tar.gz
zsh-fb6fd42e00879016660b4f68b0b10d7ff269ae05.tar.xz
zsh-fb6fd42e00879016660b4f68b0b10d7ff269ae05.zip
make assignament to $nameddirs behave like hash -d (13095)
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/parameter.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 924799c0c..df4d1020e 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -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