* 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
This commit is contained in:
eban 2001-03-20 14:50:43 +00:00
Родитель 1f904eed44
Коммит a84d087d3c
5 изменённых файлов: 39 добавлений и 25 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Tue Mar 20 23:09:33 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* win32/win32.c (win32_stat): UNC support.
* dir.c (extract_path): fix "./*" problem.
Mon Mar 19 10:55:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org> Mon Mar 19 10:55:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (glob_helper): replace lstat() by stat() to follow symlink * dir.c (glob_helper): replace lstat() by stat() to follow symlink

2
dir.c
Просмотреть файл

@ -565,7 +565,7 @@ extract_path(p, pend)
memcpy(alloc, p, len); memcpy(alloc, p, len);
if (len > 1 && pend[-1] == '/' if (len > 1 && pend[-1] == '/'
#if defined DOSISH #if defined DOSISH
&& len > 2 && pend[-2] != ':' && pend[-2] != ':'
#endif #endif
) { ) {
alloc[len-1] = 0; alloc[len-1] = 0;

Просмотреть файл

@ -1,10 +1,12 @@
require 'mkmf' require 'mkmf'
have_header("sys/stropts.h") if /mswin32|mingw/ !~ RUBY_PLATFORM
have_func("setresuid") have_header("sys/stropts.h")
$CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === RUBY_PLATFORM have_func("setresuid")
if have_func("openpty") or $CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === RUBY_PLATFORM
have_func("_getpty") or if have_func("openpty") or
have_func("ioctl") have_func("_getpty") or
create_makefile('pty') have_func("ioctl")
create_makefile('pty')
end
end end

Просмотреть файл

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.0" #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_VERSION_CODE 170
#define RUBY_RELEASE_CODE 20010319 #define RUBY_RELEASE_CODE 20010320

Просмотреть файл

@ -2668,23 +2668,29 @@ myrename(const char *oldpath, const char *newpath)
int int
win32_stat(const char *path, struct stat *st) win32_stat(const char *path, struct stat *st)
{ {
const char *p = path; const char *p;
int ret; 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 */ for (p = path, s = buf1; *p; p++, s++) {
(ISALPHA(*p) && p[1] == ':' && (p += 2, TRUE))) { /* has drive */ if (*p == '/')
if (isdirsep(*p)) p++; *s = '\\';
else
*s = *p;
} }
if (*p && (p = CharPrev(p, p + strlen(p)), isdirsep(*p))) { *s = '\0';
/* Win95/2000 fail with trailing path separator? */ len = strlen(buf1);
int len = p - path; p = CharPrev(buf1, buf1 + len);
char *s = ALLOCA_N(char, len + 1); if (*p == '\\' || *p == ':')
memcpy(s, path, len); strcat(buf1, ".");
s[len] = '\0'; else if (buf1[0] == '\\' && buf1[1] == '\\')
path = s; strcat(buf1, "\\.");
} if (_fullpath(buf2, buf1, MAXPATHLEN))
RUBY_CRITICAL(ret = stat(path, st)); return stat(buf2, st);
return ret; else
return -1;
} }
static long static long