xref: /PHP-5.3/win32/readdir.h (revision 49494bed)
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 <config.w32.h>
11 
12 #include <windows.h>
13 
14 #include <io.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <sys/types.h>
18 #include <direct.h>
19 
20 #define php_readdir_r readdir_r
21 
22 /* struct dirent - same as Unix */
23 
24 struct dirent {
25 	long d_ino;					/* inode (always 1 in WIN32) */
26 	off_t d_off;				/* offset to this dirent */
27 	unsigned short d_reclen;	/* length of d_name */
28 	char d_name[_MAX_FNAME + 1];	/* filename (null terminated) */
29 };
30 
31 
32 /* typedef DIR - not the same as Unix */
33 typedef struct {
34 	HANDLE handle;				/* _findfirst/_findnext handle */
35 	short offset;				/* offset into directory */
36 	short finished;				/* 1 if there are not more files */
37 	WIN32_FIND_DATA fileinfo;	/* from _findfirst/_findnext */
38 	char *dir;					/* the dir we are reading */
39 	struct dirent dent;			/* the dirent to return */
40 } DIR;
41 
42 /* Function prototypes */
43 DIR *opendir(const char *);
44 struct dirent *readdir(DIR *);
45 int readdir_r(DIR *, struct dirent *, struct dirent **);
46 int closedir(DIR *);
47 int rewinddir(DIR *);
48 
49 #endif /* READDIR_H */
50