From eb3d9aa14737bf83c9aef8f2e7f85d3b5c2f6e4c Mon Sep 17 00:00:00 2001 From: eban Date: Sun, 1 Apr 2001 16:21:26 +0000 Subject: [PATCH] * win32/win32.c: use ruby's opendir on mingw32. * missing/dir.h, dir.c, Makefile: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ Makefile.in | 2 +- dir.c | 8 ++++---- missing/dir.h | 5 +++-- win32/win32.c | 4 +--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3f2dcfa90..86d7507410 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Apr 2 01:16:24 2001 WATANABE Hirofumi + + * win32/win32.c: use ruby's opendir on mingw32. + + * missing/dir.h, dir.c, Makefile: ditto. + Wed Mar 28 23:43:00 2001 Nobuyoshi Nakada * ext/extmk.rb.in, lib/mkmf.rb: add C++ rules in addition to C diff --git a/Makefile.in b/Makefile.in index b1b0166b89..2f3cc984c0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -230,7 +230,7 @@ dl_os2.@OBJEXT@: $(srcdir)/missing/dl_os2.c $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/dl_os2.c win32.@OBJEXT@: $(srcdir)/win32/win32.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/win32/win32.c + $(CC) $(CFLAGS) $(CPPFLAGS) -I$(srcdir)/missing -c $(srcdir)/win32/win32.c # Prevent GNU make v3 from overflowing arg limit on SysV. .NOEXPORT: diff --git a/dir.c b/dir.c index 92da0e806c..224965186d 100644 --- a/dir.c +++ b/dir.c @@ -26,10 +26,10 @@ #include #endif -#if HAVE_DIRENT_H +#if defined HAVE_DIRENT_H && !defined NT # include # define NAMLEN(dirent) strlen((dirent)->d_name) -#elif HAVE_DIRECT_H +#elif defined HAVE_DIRECT_H && !defined NT # include # define NAMLEN(dirent) strlen((dirent)->d_name) #else @@ -44,7 +44,7 @@ # if HAVE_NDIR_H # include # endif -# if defined(NT) && defined(_MSC_VER) +# if defined(NT) # include "missing/dir.h" # endif #endif @@ -609,7 +609,7 @@ rb_glob_helper(path, flag, func, arg) rb_glob_helper(buf, flag, func, arg); free(buf); } - if (stat(dir, &st) < 0) { + if (rb_sys_stat(dir, &st) < 0) { free(base); break; } diff --git a/missing/dir.h b/missing/dir.h index 830239b3ea..4fe0e120d5 100644 --- a/missing/dir.h +++ b/missing/dir.h @@ -28,7 +28,9 @@ #ifndef __DIR_INCLUDED #define __DIR_INCLUDED -#if !defined __MINGW32__ +#if defined __MINGW32__ +#define cdecl +#endif /*Directory entry size */ #ifdef DIRSIZ #undef DIRSIZ @@ -61,5 +63,4 @@ void seekdir(DIR *dirp,long loc); void rewinddir(DIR *dirp); void closedir(DIR *dirp); -#endif #endif /* __DIR_INCLUDED */ diff --git a/win32/win32.c b/win32/win32.c index bf0165e8ac..9fb120e09d 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1278,7 +1278,6 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd) } -#if !defined __MINGW32__ // // UNIX compatible directory access functions for NT // @@ -1310,7 +1309,7 @@ opendir(char *filename) // check to see if we\'ve got a directory // - if ((stat (filename, &sbuf) < 0 || + if ((win32_stat (filename, &sbuf) < 0 || sbuf.st_mode & _S_IFDIR == 0) && (!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' || ((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) { @@ -1467,7 +1466,6 @@ closedir(DIR *dirp) free(dirp->start); free(dirp); } -#endif //