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

PATCH: Re: _values does not quote inserted matches



Bart Schaefer wrote:

> ...
> 
> The problem doesn't seem to be with _values, per se ... it's either in the
> `compvalues' C function, or somewhere down below _describe.

Right. The former. And it's weird that I forgot it there, because it
did it for comparguments. Hm. Anyaway. The patch below copies the
appropriate piece of code from comparguments to compvalues.

I'll also apply this to 4.0.


Bye
  Sven

Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.76
diff -u -r1.76 computil.c
--- Src/Zle/computil.c	18 Feb 2002 14:36:02 -0000	1.76
+++ Src/Zle/computil.c	17 Apr 2002 07:25:12 -0000
@@ -2768,6 +2768,23 @@
     return NULL;
 }
 
+static Cvval
+cv_quote_get_val(Cvdef d, char *name)
+{
+    int ne;
+
+    /* remove quotes */
+    name = dupstring(name);
+    ne = noerrs;
+    noerrs = 2;
+    parse_subst_string(name);
+    noerrs = ne;
+    remnulargs(name);
+    untokenize(name);
+
+    return cv_get_val(d, name);
+}
+
 /* Handle a xor list. */
 
 static void
@@ -2820,7 +2837,7 @@
         do {
             sav = *++s;
             *s = '\0';
-            if ((r = cv_get_val(d, v))) {
+            if ((r = cv_quote_get_val(d, v))) {
                 *s = sav;
 
                 break;
@@ -2864,7 +2881,7 @@
             sav = *sap;
             *sap = '\0';
         }
-        if ((!(r = cv_get_val(d, s)) || r->type == CVV_NOARG) && skip)
+        if ((!(r = cv_quote_get_val(d, s)) || r->type == CVV_NOARG) && skip)
             ns = as;
 
         if (sap)
@@ -2886,7 +2903,7 @@
         } else
             *ap = sap = NULL;
 
-        r = cv_get_val(d, s);
+        r = cv_quote_get_val(d, s);
 
         if (sap)
             *sap = sav;

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



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