diff options
| author | Toby Goodwin <tjg@star.le.ac.uk> | 2001-10-12 10:25:58 +0100 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:22:10 +0100 |
| commit | 609a278bf6e301ea9a021793de314ddcadb806ba (patch) | |
| tree | f8dac56d9eccbc46d5105d0206fe607ace82c3a8 /glob.c | |
| parent | 14106ccc3b2cb03c8b9a1df1a1b3e3953aaee2f8 (diff) | |
beta: rc-1.6b3
Diffstat (limited to 'glob.c')
| -rw-r--r-- | glob.c | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -34,23 +34,13 @@ static List *sort(List *); extern bool lmatch(List *s, List *p) { List *q; - int i; - bool okay; if (s == NULL) { if (p == NULL) /* null matches null */ return TRUE; - for (; p != NULL; p = p->n) { /* one or more stars match null */ - if (*p->w != '\0') { /* the null string is a special case; it does *not* match () */ - okay = TRUE; - for (i = 0; p->w[i] != '\0'; i++) - if (p->w[i] != '*' || p->m[i] != 1) { - okay = FALSE; - break; - } - if (okay) - return TRUE; - } - } + for (; p != NULL; p = p->n) /* one or more stars match null */ + if (strspn(p->w, "*") == strlen(p->w) && + p->m != NULL && strlen(p->m) == strlen(p->w)) + return TRUE; return FALSE; } for (; s != NULL; s = s->n) |