rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit b2569daad007df645bd39513a5f45e8b5743d243
parent 602e014ebbd4303a2bf474e1a8c3085b7ef94ecb
Author: tjg <tjg>
Date:   Fri, 10 Dec 1999 10:30:08 +0000

`/' special case just moves elsewhere...
remove use of commas to separate statements

Diffstat:
Mglob.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/glob.c b/glob.c @@ -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.