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

PATCH: 3.0.5 Glob qualifier close parenthesis tidy up



On Mar 19,  3:32pm, Peter Stephenson wrote:
} Subject: Glob qualifier close parenthesis tidy up
}
} This fixes
} 
} % print foo(:g/o/a)
} fa?o
}   ^ 8-bit squiggle
} 
} which is actually two bugs: first, the `)' was included; second, the
} tokens in the expression weren't removed.

Here's the patch against the original 3.0.5 (i.e., PWS's kshglob patch
is -not- needed first).

--- glob.c.orig	Wed Nov 19 08:40:29 1997
+++ glob.c	Thu Mar 19 09:03:07 1998
@@ -144,6 +144,8 @@
     }
     if (*str == ':' && str[-1] == Inpar) {
 	str[-1] = '\0';
+	str[strlen(str)-1] = '\0';
+	untokenize(str);
 	modify((char **) &getdata(np), &str);
 	return;
     }
@@ -175,8 +177,9 @@
 		break;
 	if (*s == Inpar) {
 	    /* Real qualifiers found. */
+	    str[sl-1] = '\0';
 	    *s++ = '\0';
-	    while (*s != Outpar && !colonmod) {
+	    while (*s && !colonmod) {
 		func = (int (*) _((Statptr, long)))0;
 		if (idigit(*s)) {
 		    /* Store numeric argument for qualifier */
@@ -202,6 +205,7 @@
 			/* Remaining arguments are history-type     *
 			 * colon substitutions, handled separately. */
 			colonmod = s - 1;
+			untokenize(colonmod);
 			break;
 		    case Hat:
 		    case '^':
@@ -363,7 +367,7 @@
 				    zerr("unknown user", NULL, 0);
 				    data = 0;
 				}
-				if ((*tt = sav) != Outpar)
+				if ((*tt = sav))
 				    s = tt + 1;
 				else
 				    s = tt;
@@ -396,7 +400,7 @@
 				    zerr("unknown group", NULL, 0);
 				    data = 0;
 				}
-				if ((*tt = sav) != Outpar)
+				if ((*tt = sav))
 				    s = tt + 1;
 				else
 				    s = tt;

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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