79 #define WIN32_LEAN_AND_MEAN 
   83 #include <sys/types.h> 
   88 #if !defined(FILE_ATTRIBUTE_DEVICE) 
   89 # define FILE_ATTRIBUTE_DEVICE 0x40 
   93 #if defined(_MSC_VER)  &&  !defined(S_IREAD) 
   94 # define S_IFMT   _S_IFMT                       
   95 # define S_IFDIR  _S_IFDIR                      
   96 # define S_IFCHR  _S_IFCHR                      
   97 # define S_IFFIFO _S_IFFIFO                     
   98 # define S_IFREG  _S_IFREG                      
   99 # define S_IREAD  _S_IREAD                      
  100 # define S_IWRITE _S_IWRITE                     
  101 # define S_IEXEC  _S_IEXEC                      
  107 #if defined(_MSC_VER) 
  108 # define S_IRUSR  S_IREAD                       
  109 # define S_IWUSR  S_IWRITE                      
  120 #define _DIRENT_HAVE_D_TYPE 
  124 #define DT_REG      S_IFREG 
  125 #define DT_DIR      S_IFDIR 
  126 #define DT_FIFO     S_IFFIFO 
  127 #define DT_SOCK     S_IFSOCK 
  128 #define DT_CHR      S_IFCHR 
  129 #define DT_BLK      S_IFBLK 
  132 #define IFTODT(mode) ((mode) & S_IFMT) 
  133 #define DTTOIF(type) (type) 
  141 #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO) 
  142 #define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR) 
  143 #define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG) 
  144 #define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK) 
  145 #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) 
  146 #define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR) 
  147 #define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK) 
  173 static DIR *opendir(
const char *dirname);
 
  174 static struct dirent *readdir(
DIR *dirp);
 
  175 static int closedir(
DIR *dirp);
 
  176 static void rewinddir(
DIR* dirp);
 
  180 #if defined(_MSC_VER) && _MSC_VER >= 1400 
  181 # define DIRENT_STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE) 
  183 # define DIRENT_STRNCPY(dest,src,size) strncpy((dest),(src),(size)) 
  187 #if defined(_MSC_VER) 
  188 #define DIRENT_SET_ERRNO(x) _set_errno (x) 
  190 #define DIRENT_SET_ERRNO(x) (errno = (x)) 
  199 static DIR *opendir(
const char *dirname)
 
  204    if (dirname == NULL) {
 
  208    if (strlen (dirname) + 3 >= MAX_PATH) {
 
  214    dirp = (
DIR*) malloc (
sizeof (
struct DIR));
 
  223       if (GetFullPathNameA (dirname, MAX_PATH, dirp->
patt, NULL)) {
 
  227          p = strchr (dirp->
patt, 
'\0');
 
  228          if (dirp->
patt < p  &&  *(p-1) != 
'\\'  &&  *(p-1) != 
':') {
 
  307    } 
else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
 
  321 static int closedir(
DIR *dirp)
 
  348 static void rewinddir(
DIR* dirp)
 
#define DIRENT_STRNCPY(dest, src, size)
Definition: wdirent.h:183
 
#define DT_DIR
Definition: wdirent.h:125
 
Definition: wdirent.h:162
 
int d_type
Definition: wdirent.h:158
 
Definition: wdirent.h:154
 
char patt[MAX_PATH+3]
Definition: wdirent.h:168
 
char d_name[MAX_PATH+1]
Definition: wdirent.h:156
 
size_t d_namlen
Definition: wdirent.h:157
 
#define DIRENT_SET_ERRNO(x)
Definition: wdirent.h:190
 
dirent curentry
Definition: wdirent.h:164
 
WIN32_FIND_DATAA find_data
Definition: wdirent.h:165
 
HANDLE search_handle
Definition: wdirent.h:167
 
#define FILE_ATTRIBUTE_DEVICE
Definition: wdirent.h:89
 
int cached
Definition: wdirent.h:166
 
#define DT_REG
Definition: wdirent.h:124
 
#define DT_CHR
Definition: wdirent.h:128