diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-04-15 18:07:38 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-04-15 18:07:38 +0000 |
commit | f13624e0f8a3c28c90aa0ce8ee36b639a491e4a9 (patch) | |
tree | 7ebc57c7b2ceed481e23f598011dc88d159c9178 /Src/glob.c | |
parent | a61dc2074ae6cd00f1c166dc0102c491db056060 (diff) | |
download | zsh-f13624e0f8a3c28c90aa0ce8ee36b639a491e4a9.tar.gz zsh-f13624e0f8a3c28c90aa0ce8ee36b639a491e4a9.tar.xz zsh-f13624e0f8a3c28c90aa0ce8ee36b639a491e4a9.zip |
zsh-3.1.5-pws-2 zsh-3.1.5-pws-2
Diffstat (limited to 'Src/glob.c')
-rw-r--r-- | Src/glob.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/Src/glob.c b/Src/glob.c index 0c66adec8..ea5d0133c 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -355,21 +355,12 @@ scanner(Complist q) insert(c->str, 0); } else { /* Do pattern matching on current path section. */ - char *fn; + char *fn = pathbuf[pathbufcwd] ? unmeta(pathbuf + pathbufcwd) : "."; int dirs = !!q->next; - DIR *lock; + DIR *lock = opendir(fn); char *subdirs = NULL; int subdirlen = 0; - fn = pathbuf[pathbufcwd] ? unmeta(pathbuf + pathbufcwd) : "."; - if (dirs) { - struct stat st; - stat(fn, &st); - /* a directory with subdirectories has link count greater than 2 */ - if (!S_ISDIR(st.st_mode) || st.st_nlink == 2) - return; - } - lock = opendir(fn); if (lock == NULL) return; while ((fn = zreaddir(lock, 1)) && !errflag) { @@ -594,7 +585,8 @@ parsecomp(int gflag) pptr[1] && pptr[1] != Outpar && pptr[1] != Bar) || *pptr == Outpar) { if (*pptr == '/' || !*pptr || - (isset(EXTENDEDGLOB) && *pptr == Tilde && + ((*pptr == Bar || + (isset(EXTENDEDGLOB) && *pptr == Tilde)) && (gflag & GF_TOPLEV))) c->stat |= C_LAST; return c; @@ -746,7 +738,8 @@ parsecomp(int gflag) } /* mark if last pattern component in path component or pattern */ if (*pptr == '/' || !*pptr || - (isset(EXTENDEDGLOB) && *pptr == Tilde && (gflag & GF_TOPLEV))) + ((*pptr == Bar || + (isset(EXTENDEDGLOB) && *pptr == Tilde)) && (gflag & GF_TOPLEV))) c->stat |= C_LAST; c->str = dupstrpfx(cstr, pptr - cstr); return c; |