From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16605 invoked from network); 19 Jun 1997 09:04:07 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 19 Jun 1997 09:04:07 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id EAA12890; Thu, 19 Jun 1997 04:51:41 -0400 (EDT) Resent-Date: Thu, 19 Jun 1997 04:51:41 -0400 (EDT) Message-Id: <199706190855.KAA23247@sgi.ifh.de> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: bug or feature? In-reply-to: "Vinnie Shelton"'s message of "Wed, 18 Jun 1997 14:13:40 MET." <9706181813.AA25273@grind.icd.teradyne.com> Date: Thu, 19 Jun 1997 10:55:37 +0200 From: Peter Stephenson Resent-Message-ID: <"5d1gJ1.0.L93.TCFgp"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3261 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Vinnie Shelton wrote: > Peter, > Your patch (in archive/latest/3249) failed for me vs. 3.0.4. > Can you generate a patch against 3.0.4? Here's a patch against 3.0.3. There are just some minor structural changes in the code. *** Src/glob.c.orig Tue Jun 3 07:11:26 1997 --- Src/glob.c Thu Jun 19 10:51:09 1997 *************** *** 1578,1583 **** --- 1578,1587 ---- zerr("no idea how you got this error message.", NULL, 0); } + /* Flags passed down to guts when compiling */ + #define GF_PATHADD 1 /* file glob, adding path components */ + #define GF_TOPLEV 2 /* outside (), so ~ ends main match */ + static char *pptr; /* current place in string being matched */ static Comp tail = 0; static int first; /* are leading dots special? */ *************** *** 1843,1849 **** remnulargs(str); mode = 1; /* no path components */ pptr = str; ! return parsecompsw(0); } /* Parse a series of path components pointed to by pptr */ --- 1847,1853 ---- remnulargs(str); mode = 1; /* no path components */ pptr = str; ! return parsecompsw(GF_TOPLEV); } /* Parse a series of path components pointed to by pptr */ *************** *** 1905,1911 **** } } else { /* parse single path component */ ! if (!(c1 = parsecompsw(1))) return NULL; /* then do the remaining path compoents */ if (*pptr == '/' || !*pptr) { --- 1909,1915 ---- } } else { /* parse single path component */ ! if (!(c1 = parsecompsw(GF_PATHADD|GF_TOPLEV))) return NULL; /* then do the remaining path compoents */ if (*pptr == '/' || !*pptr) { *************** *** 1926,1932 **** /**/ Comp ! parsecomp(void) { Comp c = (Comp) alloc(sizeof *c), c1, c2; char *cstr, *ls = NULL; --- 1930,1936 ---- /**/ Comp ! parsecomp(int gflag) { Comp c = (Comp) alloc(sizeof *c), c1, c2; char *cstr, *ls = NULL; *************** *** 1946,1952 **** /* negate remaining pattern */ pptr++; c->str = dupstrpfx(cstr, pptr - cstr); ! if (!(c->next = parsecomp())) return NULL; return c; } --- 1950,1956 ---- /* negate remaining pattern */ pptr++; c->str = dupstrpfx(cstr, pptr - cstr); ! if (!(c->next = parsecomp(gflag))) return NULL; return c; } *************** *** 1963,1969 **** c1 = (Comp) alloc(sizeof *c1); *(c1->str = dupstring("?")) = Quest; c1->stat |= C_ONEHASH; ! if (!(c2 = parsecomp())) return NULL; c1->next = c2; c->next = c1; --- 1967,1973 ---- c1 = (Comp) alloc(sizeof *c1); *(c1->str = dupstring("?")) = Quest; c1->stat |= C_ONEHASH; ! if (!(c2 = parsecomp(gflag))) return NULL; c1->next = c2; c->next = c1; *************** *** 1990,1996 **** } } /* Parse the remaining pattern following the group... */ ! if (!(c1 = parsecomp())) return NULL; /* ...remembering what comes after it... */ tail = dpnd ? NULL : c1; --- 1994,2000 ---- } } /* Parse the remaining pattern following the group... */ ! if (!(c1 = parsecomp(gflag))) return NULL; /* ...remembering what comes after it... */ tail = dpnd ? NULL : c1; *************** *** 2027,2033 **** c1->next = c2; c2->stat |= C_ONEHASH; /* parse the rest of the pattern and return. */ ! c2->next = parsecomp(); if (!c2->next) return NULL; c->str = dupstrpfx(cstr, ls - cstr); --- 2031,2037 ---- c1->next = c2; c2->stat |= C_ONEHASH; /* parse the rest of the pattern and return. */ ! c2->next = parsecomp(gflag); if (!c2->next) return NULL; c->str = dupstrpfx(cstr, ls - cstr); *************** *** 2059,2065 **** pptr++; } /* mark if last pattern component in path component or pattern */ ! if (*pptr == '/' || !*pptr) c->stat |= C_LAST; c->str = dupstrpfx(cstr, pptr - cstr); return c; --- 2063,2070 ---- pptr++; } /* mark if last pattern component in path component or pattern */ ! if (*pptr == '/' || !*pptr || ! (isset(EXTENDEDGLOB) && *pptr == Tilde && (gflag & GF_TOPLEV))) c->stat |= C_LAST; c->str = dupstrpfx(cstr, pptr - cstr); return c; *************** *** 2069,2079 **** /**/ Comp ! parsecompsw(int pathadd) { Comp c1, c2, c3, excl = NULL; ! c1 = parsecomp(); if (!c1) return NULL; if (isset(EXTENDEDGLOB) && *pptr == Tilde) { --- 2074,2084 ---- /**/ Comp ! parsecompsw(int gflag) { Comp c1, c2, c3, excl = NULL; ! c1 = parsecomp(gflag); if (!c1) return NULL; if (isset(EXTENDEDGLOB) && *pptr == Tilde) { *************** *** 2082,2088 **** mode = 1; pptr++; ! excl = parsecomp(); mode = oldmode; if (!excl) return NULL; --- 2087,2093 ---- mode = 1; pptr++; ! excl = parsecomp(gflag); mode = oldmode; if (!excl) return NULL; *************** *** 2093,2099 **** if (*pptr == Bar) { /* get the next alternative after the | */ pptr++; ! c3 = parsecompsw(pathadd); if (!c3) return NULL; } else { --- 2098,2104 ---- if (*pptr == Bar) { /* get the next alternative after the | */ pptr++; ! c3 = parsecompsw(gflag); if (!c3) return NULL; } else { *************** *** 2106,2112 **** c2->left = c1; c2->right = c3; c2->exclude = excl; ! if (pathadd) c2->stat |= C_PATHADD; return c2; } --- 2111,2117 ---- c2->left = c1; c2->right = c3; c2->exclude = excl; ! if (gflag & GF_PATHADD) c2->stat |= C_PATHADD; return c2; } -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413 Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.