1 #ifndef READDIR_H 2 #define READDIR_H 3 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 9 /* 10 * Structures and types used to implement opendir/readdir/closedir 11 * on Windows. 12 */ 13 14 #include <config.w32.h> 15 16 #include "ioutil.h" 17 18 #define php_readdir_r readdir_r 19 20 /* struct dirent - same as Unix */ 21 struct dirent { 22 long d_ino; /* inode (always 1 in WIN32) */ 23 off_t d_off; /* offset to this dirent */ 24 unsigned short d_reclen; /* length of d_name */ 25 char d_name[1]; /* null terminated filename in the current encoding, glyph number <= 255 wchar_t's + \0 byte */ 26 }; 27 28 /* typedef DIR - not the same as Unix */ 29 struct DIR_W32 { 30 HANDLE handle; /* _findfirst/_findnext handle */ 31 uint16_t offset; /* offset into directory */ 32 uint8_t finished; /* 1 if there are not more files */ 33 WIN32_FIND_DATAW fileinfo; /* from _findfirst/_findnext */ 34 wchar_t *dirw; /* the dir we are reading */ 35 struct dirent dent; /* the dirent to return */ 36 }; 37 typedef struct DIR_W32 DIR; 38 39 /* Function prototypes */ 40 DIR *opendir(const char *); 41 struct dirent *readdir(DIR *); 42 int readdir_r(DIR *, struct dirent *, struct dirent **); 43 int closedir(DIR *); 44 int rewinddir(DIR *); 45 46 #ifdef __cplusplus 47 } 48 #endif 49 50 #endif /* READDIR_H */ 51 52 /* 53 * Local variables: 54 * tab-width: 4 55 * c-basic-offset: 4 56 * End: 57 * vim600: sw=4 ts=4 fdm=marker 58 * vim<600: sw=4 ts=4 59 */ 60