diff options
| author | Toby Goodwin <tjg@star.le.ac.uk> | 1999-12-10 11:55:04 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:22:10 +0100 |
| commit | 14106ccc3b2cb03c8b9a1df1a1b3e3953aaee2f8 (patch) | |
| tree | bf26805b81698d4ca6f9e7aa7bce3580805286fc /glob.c | |
| parent | 3e9e4d3f8f518f8f467066593ae6f270d97f6d60 (diff) | |
beta: rc-1.6b2
Diffstat (limited to 'glob.c')
| -rw-r--r-- | glob.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -127,6 +127,7 @@ static List *dmatch(char *d, char *p, char *m) { } top = r = NULL; + if (*d == '\0') d = "/"; if ((dirp = opendir(d)) == NULL) return NULL; /* opendir succeeds on regular files on some systems, so the stat() call is necessary (sigh) */ @@ -216,8 +217,10 @@ static List *doglob(char *w, char *m) { p = pattern; md = metadir; mp = metapattern; - while (*s != '/' && *s != '\0') - *d++ = *s++, *md++ = *m++; /* get first directory component */ + while (*s != '/' && *s != '\0') { + *d++ = *s++; /* get first directory component */ + *md++ = *m++; + } *d = '\0'; /* Special case: no slashes in the pattern, i.e., open the current directory. |