From a84d087d3cb142ae76b5e257948f6bd70d7873f7 Mon Sep 17 00:00:00 2001 From: eban Date: Tue, 20 Mar 2001 14:50:43 +0000 Subject: * win32/win32.c (win32_stat): UNC support. * dir.c (extract_path): fix "./*" problem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ dir.c | 2 +- ext/pty/extconf.rb | 16 +++++++++------- version.h | 4 ++-- win32/win32.c | 38 ++++++++++++++++++++++---------------- 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bf8f8d8ee..7eb82ff819 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Mar 20 23:09:33 2001 WATANABE Hirofumi + + * win32/win32.c (win32_stat): UNC support. + + * dir.c (extract_path): fix "./*" problem. + Mon Mar 19 10:55:10 2001 Yukihiro Matsumoto * dir.c (glob_helper): replace lstat() by stat() to follow symlink diff --git a/dir.c b/dir.c index 289cb4c2cd..560e2cd924 100644 --- a/dir.c +++ b/dir.c @@ -565,7 +565,7 @@ extract_path(p, pend) memcpy(alloc, p, len); if (len > 1 && pend[-1] == '/' #if defined DOSISH - && len > 2 && pend[-2] != ':' + && pend[-2] != ':' #endif ) { alloc[len-1] = 0; diff --git a/ext/pty/extconf.rb b/ext/pty/extconf.rb index 4df2011eb5..ba2b44c70b 100644 --- a/ext/pty/extconf.rb +++ b/ext/pty/extconf.rb @@ -1,10 +1,12 @@ require 'mkmf' -have_header("sys/stropts.h") -have_func("setresuid") -$CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === RUBY_PLATFORM -if have_func("openpty") or - have_func("_getpty") or - have_func("ioctl") - create_makefile('pty') +if /mswin32|mingw/ !~ RUBY_PLATFORM + have_header("sys/stropts.h") + have_func("setresuid") + $CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === RUBY_PLATFORM + if have_func("openpty") or + have_func("_getpty") or + have_func("ioctl") + create_makefile('pty') + end end diff --git a/version.h b/version.h index 44eed6fe86..ca886e9717 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.0" -#define RUBY_RELEASE_DATE "2001-03-19" +#define RUBY_RELEASE_DATE "2001-03-20" #define RUBY_VERSION_CODE 170 -#define RUBY_RELEASE_CODE 20010319 +#define RUBY_RELEASE_CODE 20010320 diff --git a/win32/win32.c b/win32/win32.c index e170f1b226..da657a540f 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2668,23 +2668,29 @@ myrename(const char *oldpath, const char *newpath) int win32_stat(const char *path, struct stat *st) { - const char *p = path; - int ret; + const char *p; + char *buf1 = ALLOCA_N(char, strlen(path) + 1); + char *buf2 = ALLOCA_N(char, MAXPATHLEN); + char *s; + int len; - if ((isdirsep(*p) && (p++, TRUE)) || /* absolute path or UNC */ - (ISALPHA(*p) && p[1] == ':' && (p += 2, TRUE))) { /* has drive */ - if (isdirsep(*p)) p++; - } - if (*p && (p = CharPrev(p, p + strlen(p)), isdirsep(*p))) { - /* Win95/2000 fail with trailing path separator? */ - int len = p - path; - char *s = ALLOCA_N(char, len + 1); - memcpy(s, path, len); - s[len] = '\0'; - path = s; - } - RUBY_CRITICAL(ret = stat(path, st)); - return ret; + for (p = path, s = buf1; *p; p++, s++) { + if (*p == '/') + *s = '\\'; + else + *s = *p; + } + *s = '\0'; + len = strlen(buf1); + p = CharPrev(buf1, buf1 + len); + if (*p == '\\' || *p == ':') + strcat(buf1, "."); + else if (buf1[0] == '\\' && buf1[1] == '\\') + strcat(buf1, "\\."); + if (_fullpath(buf2, buf1, MAXPATHLEN)) + return stat(buf2, st); + else + return -1; } static long -- cgit v1.2.3