1 #ifndef READDIR_H 2 #define READDIR_H 3 4 5 /* 6 * Structures and types used to implement opendir/readdir/closedir 7 * on Windows 95/NT. 8 */ 9 10 #include <windows.h> 11 12 #include <io.h> 13 #include <stdio.h> 14 #include <stdlib.h> 15 #include <sys/types.h> 16 #include <direct.h> 17 18 /* struct dirent - same as Unix */ 19 20 struct dirent { 21 long d_ino; /* inode (always 1 in WIN32) */ 22 off_t d_off; /* offset to this dirent */ 23 unsigned short d_reclen; /* length of d_name */ 24 char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */ 25 }; 26 27 28 /* typedef DIR - not the same as Unix */ 29 typedef struct { 30 HANDLE handle; /* _findfirst/_findnext handle */ 31 short offset; /* offset into directory */ 32 short finished; /* 1 if there are not more files */ 33 WIN32_FIND_DATA fileinfo; /* from _findfirst/_findnext */ 34 char *dir; /* the dir we are reading */ 35 struct dirent dent; /* the dirent to return */ 36 } DIR; 37 38 /* Function prototypes */ 39 DIR *opendir(const char *); 40 struct dirent *readdir(DIR *); 41 int readdir_r(DIR *, struct dirent *, struct dirent **); 42 int closedir(DIR *); 43 int rewinddir(DIR *); 44 45 #endif /* READDIR_H */ 46