Hello,
On Sun, Apr 04, 2010 at 11:41:56AM +0930, Matthew Haub wrote:
> The following patch fixes ksh autocomplete support for files within
> directories containing []:`$= characters. This also fixes the problem
> ray@ was experiencing with the back quotes in PR user/6006.
Here's the same patch with an unnecessary if statement removed.
Index: edit.c
===================================================================
RCS file: /cvs/src/bin/ksh/edit.c,v
retrieving revision 1.33
diff -u edit.c
--- edit.c 2 Aug 2007 10:50:25 -0000 1.33
+++ edit.c 4 Apr 2010 04:07:00 -0000
@@ -391,9 +391,20 @@
continue;
}
+ /* except for characters that must be quoted to the lexer */
+ if (escaping) {
+ escaping = 0;
+
+ switch (toglob[i]) {
+ case '[':
+ case '`':
+ case '$':
+ toglob[idx++] = '\\';
+ }
+ }
+
toglob[idx] = toglob[i];
idx++;
- if (escaping) escaping = 0;
}
toglob[idx] = '\0';
@@ -847,7 +858,7 @@
int rval=0;
for (add = 0, wlen = len; wlen - add > 0; add++) {
- if (strchr("\\$(){}[]?*&;#|<>\"'`", s[add]) || strchr(ifs,
s[add])) {
+ if (strchr("\\$(){}[]?*&;#|<>\"'=`:", s[add]) || strchr(ifs,
s[add])) {
if (putbuf_func(s, add) != 0) {
rval = -1;
break;
Index: lex.c
===================================================================
RCS file: /cvs/src/bin/ksh/lex.c,v
retrieving revision 1.44
diff -u lex.c
--- lex.c 3 Jul 2008 17:52:08 -0000 1.44
+++ lex.c 4 Apr 2010 04:07:00 -0000
@@ -289,7 +289,9 @@
c = getsc();
switch (c) {
case '\\':
- case '$': case '`':
+ case '$':
+ case '`':
+ case '[':
*wp++ = QCHAR, *wp++ = c;
break;
case '"':