Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: parameter frag K



Tanaka Akira wrote:

> I found a problem of the parameter frag K.
> 
> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% t='['
> is27e1u11% typeset -A a
> is27e1u11% a=('\[' x)
> is27e1u11% print -lr - $a[(K)$t]     
> 
> is27e1u11% 
> 
> This should print `x'.

Small tokenization problem here...

Bye
 Sven

diff -ru ../z.old/Src/params.c Src/params.c
--- ../z.old/Src/params.c	Fri Jan 28 10:23:25 2000
+++ Src/params.c	Fri Jan 28 14:05:28 2000
@@ -376,6 +376,7 @@
 	char *tmp = dupstring(v.pm->nam);
 
 	tokenize(tmp);
+	remnulargs(tmp);
 
 	if (!(prog = patcompile(tmp, 0, NULL)) || !pattry(prog, scanstr))
 	    return;
@@ -966,9 +967,10 @@
 		if (ishash) {
 		    scanprog = pprog;
 		    scanstr = s;
-		    if (keymatch)
+		    if (keymatch) {
+			untokenize(s);
 			v->isarr |= SCANPM_KEYMATCH;
-		    else if (ind)
+		    } else if (ind)
 			v->isarr |= SCANPM_MATCHKEY;
 		    else
 			v->isarr |= SCANPM_MATCHVAL;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author