1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
eban 2001-04-01 16:21:26 +00:00
parent 80b1bf4612
commit eb3d9aa147
5 changed files with 15 additions and 10 deletions

View file

@ -1,3 +1,9 @@
Mon Apr 2 01:16:24 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* 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 <nobu.nakada@nifty.ne.jp> Wed Mar 28 23:43:00 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* ext/extmk.rb.in, lib/mkmf.rb: add C++ rules in addition to C * ext/extmk.rb.in, lib/mkmf.rb: add C++ rules in addition to C

View file

@ -230,7 +230,7 @@ dl_os2.@OBJEXT@: $(srcdir)/missing/dl_os2.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/dl_os2.c $(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/missing/dl_os2.c
win32.@OBJEXT@: $(srcdir)/win32/win32.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. # Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT: .NOEXPORT:

8
dir.c
View file

@ -26,10 +26,10 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if HAVE_DIRENT_H #if defined HAVE_DIRENT_H && !defined NT
# include <dirent.h> # include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name) # define NAMLEN(dirent) strlen((dirent)->d_name)
#elif HAVE_DIRECT_H #elif defined HAVE_DIRECT_H && !defined NT
# include <direct.h> # include <direct.h>
# define NAMLEN(dirent) strlen((dirent)->d_name) # define NAMLEN(dirent) strlen((dirent)->d_name)
#else #else
@ -44,7 +44,7 @@
# if HAVE_NDIR_H # if HAVE_NDIR_H
# include <ndir.h> # include <ndir.h>
# endif # endif
# if defined(NT) && defined(_MSC_VER) # if defined(NT)
# include "missing/dir.h" # include "missing/dir.h"
# endif # endif
#endif #endif
@ -609,7 +609,7 @@ rb_glob_helper(path, flag, func, arg)
rb_glob_helper(buf, flag, func, arg); rb_glob_helper(buf, flag, func, arg);
free(buf); free(buf);
} }
if (stat(dir, &st) < 0) { if (rb_sys_stat(dir, &st) < 0) {
free(base); free(base);
break; break;
} }

View file

@ -28,7 +28,9 @@
#ifndef __DIR_INCLUDED #ifndef __DIR_INCLUDED
#define __DIR_INCLUDED #define __DIR_INCLUDED
#if !defined __MINGW32__ #if defined __MINGW32__
#define cdecl
#endif
/*Directory entry size */ /*Directory entry size */
#ifdef DIRSIZ #ifdef DIRSIZ
#undef DIRSIZ #undef DIRSIZ
@ -61,5 +63,4 @@ void seekdir(DIR *dirp,long loc);
void rewinddir(DIR *dirp); void rewinddir(DIR *dirp);
void closedir(DIR *dirp); void closedir(DIR *dirp);
#endif
#endif /* __DIR_INCLUDED */ #endif /* __DIR_INCLUDED */

View file

@ -1278,7 +1278,6 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
} }
#if !defined __MINGW32__
// //
// UNIX compatible directory access functions for NT // UNIX compatible directory access functions for NT
// //
@ -1310,7 +1309,7 @@ opendir(char *filename)
// check to see if we\'ve got a directory // 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) && sbuf.st_mode & _S_IFDIR == 0) &&
(!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' || (!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) { ((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) {
@ -1467,7 +1466,6 @@ closedir(DIR *dirp)
free(dirp->start); free(dirp->start);
free(dirp); free(dirp);
} }
#endif
// //