summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-25 04:33:53 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-25 04:33:53 +0000
commit75ddce9a5d288c77afde8420fcc4e08505e96064 (patch)
tree2dbb8ab6969cfa1bfed8ba0b896ec07421d2c332 /dir.c
parentaa806d78117901096bce99483ce5cf6380aba22a (diff)
eban
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/dir.c b/dir.c
index efb28e6848..6bdff19d20 100644
--- a/dir.c
+++ b/dir.c
@@ -511,9 +511,11 @@ has_magic(s, send)
return Qtrue;
continue;
+#if !defined DOSISH
case '\\':
if (*p++ == '\0')
return Qfalse;
+#endif
}
if (send && p >= send) break;
@@ -531,7 +533,7 @@ extract_path(p, pend)
len = pend - p;
alloc = ALLOC_N(char, len+1);
memcpy(alloc, p, len);
- if (len > 1 && pend[-1] == '/') {
+ if (len > 1 && isdirsep(pend[-1])) {
alloc[len-1] = 0;
}
else {
@@ -547,7 +549,7 @@ extract_elem(path)
{
char *pend;
- pend = strchr(path, '/');
+ pend = find_dirsep(path);
if (!pend) pend = path + strlen(path);
return extract_path(path, pend);
@@ -575,8 +577,8 @@ rb_glob(path, func, arg)
p = path;
while (p) {
- if (*p == '/') p++;
- m = strchr(p, '/');
+ if (isdirsep(*p)) p++;
+ m = find_dirsep(p);
if (has_magic(p, m)) {
char *dir, *base, *magic, *buf;
DIR *dirp;
@@ -605,7 +607,7 @@ rb_glob(path, func, arg)
free(base);
break;
}
-#define BASE (*base && !(*base == '/' && !base[1]))
+#define BASE (*base && !(isdirsep(*base) && !base[1]))
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
if (recursive) {