summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--dir.c12
-rw-r--r--win32/win32.c7
3 files changed, 12 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index e720664e4b..d73bbef671 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
Mon Sep 25 13:31:45 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
- * dir.c (rb_glob): DOSISH support.
+ * win32/win32.c (NtCmdGlob): substitute '\\' with '/'.
Mon Sep 25 00:35:01 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
diff --git a/dir.c b/dir.c
index 6bdff19d20..efb28e6848 100644
--- a/dir.c
+++ b/dir.c
@@ -511,11 +511,9 @@ has_magic(s, send)
return Qtrue;
continue;
-#if !defined DOSISH
case '\\':
if (*p++ == '\0')
return Qfalse;
-#endif
}
if (send && p >= send) break;
@@ -533,7 +531,7 @@ extract_path(p, pend)
len = pend - p;
alloc = ALLOC_N(char, len+1);
memcpy(alloc, p, len);
- if (len > 1 && isdirsep(pend[-1])) {
+ if (len > 1 && pend[-1] == '/') {
alloc[len-1] = 0;
}
else {
@@ -549,7 +547,7 @@ extract_elem(path)
{
char *pend;
- pend = find_dirsep(path);
+ pend = strchr(path, '/');
if (!pend) pend = path + strlen(path);
return extract_path(path, pend);
@@ -577,8 +575,8 @@ rb_glob(path, func, arg)
p = path;
while (p) {
- if (isdirsep(*p)) p++;
- m = find_dirsep(p);
+ if (*p == '/') p++;
+ m = strchr(p, '/');
if (has_magic(p, m)) {
char *dir, *base, *magic, *buf;
DIR *dirp;
@@ -607,7 +605,7 @@ rb_glob(path, func, arg)
free(base);
break;
}
-#define BASE (*base && !(isdirsep(*base) && !base[1]))
+#define BASE (*base && !(*base == '/' && !base[1]))
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
if (recursive) {
diff --git a/win32/win32.c b/win32/win32.c
index f8de990bad..05b971c057 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -873,13 +873,18 @@ NtCmdGlob (NtCmdLineElement *patt)
{
ListInfo listinfo;
char buffer[MAXPATHLEN], *buf = buffer;
+ char *p, *pend, *pb;
listinfo.head = listinfo.tail = 0;
if (patt->len >= MAXPATHLEN)
buf = ruby_xmalloc(patt->len + 1);
- strncpy(buf, patt->str, patt->len);
+ p = patt->str;
+ pend = p + patt->len;
+ pb = buf;
+ for (; p < pend; p = CharNext(p))
+ *pb++ = *p == '\\' ? '/' : *p;
buf[patt->len] = 0;
rb_glob(buf, insert, (VALUE)&listinfo);
if (buf != buffer)