Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / include / dirent.h
bloba18cbcab902d5cc7566f783c948ad595b6e921b0
1 /*
2 * DIRENT.H (formerly DIRLIB.H)
3 * This file has no copyright assigned and is placed in the Public Domain.
4 * This file is a part of the mingw-runtime package.
5 * No warranty is given; refer to the file DISCLAIMER within the package.
7 */
8 #ifndef _DIRENT_H_
9 #define _DIRENT_H_
11 /* All the headers include this file. */
12 #include <_mingw.h>
14 #include <io.h>
16 #ifndef RC_INVOKED
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
22 struct dirent
24 long d_ino; /* Always zero. */
25 unsigned short d_reclen; /* Always zero. */
26 unsigned short d_namlen; /* Length of name in d_name. */
27 char d_name[FILENAME_MAX]; /* File name. */
31 * This is an internal data structure. Good programmers will not use it
32 * except as an argument to one of the functions below.
33 * dd_stat field is now int (was short in older versions).
35 typedef struct
37 /* disk transfer area for this dir */
38 struct _finddata_t dd_dta;
40 /* dirent struct to return from dir (NOTE: this makes this thread
41 * safe as long as only one thread uses a particular DIR struct at
42 * a time) */
43 struct dirent dd_dir;
45 /* _findnext handle */
46 long dd_handle;
49 * Status of search:
50 * 0 = not started yet (next entry to read is first entry)
51 * -1 = off the end
52 * positive = 0 based index of next entry
54 int dd_stat;
56 /* given path for dir with search pattern (struct is extended) */
57 char dd_name[1];
58 } DIR;
60 DIR* __cdecl opendir (const char*);
61 struct dirent* __cdecl readdir (DIR*);
62 int __cdecl closedir (DIR*);
63 void __cdecl rewinddir (DIR*);
64 long __cdecl telldir (DIR*);
65 void __cdecl seekdir (DIR*, long);
68 /* wide char versions */
70 struct _wdirent
72 long d_ino; /* Always zero. */
73 unsigned short d_reclen; /* Always zero. */
74 unsigned short d_namlen; /* Length of name in d_name. */
75 wchar_t d_name[FILENAME_MAX]; /* File name. */
79 * This is an internal data structure. Good programmers will not use it
80 * except as an argument to one of the functions below.
82 typedef struct
84 /* disk transfer area for this dir */
85 struct _wfinddata_t dd_dta;
87 /* dirent struct to return from dir (NOTE: this makes this thread
88 * safe as long as only one thread uses a particular DIR struct at
89 * a time) */
90 struct _wdirent dd_dir;
92 /* _findnext handle */
93 long dd_handle;
96 * Status of search:
97 * 0 = not started yet (next entry to read is first entry)
98 * -1 = off the end
99 * positive = 0 based index of next entry
101 int dd_stat;
103 /* given path for dir with search pattern (struct is extended) */
104 wchar_t dd_name[1];
105 } _WDIR;
109 _WDIR* __cdecl _wopendir (const wchar_t*);
110 struct _wdirent* __cdecl _wreaddir (_WDIR*);
111 int __cdecl _wclosedir (_WDIR*);
112 void __cdecl _wrewinddir (_WDIR*);
113 long __cdecl _wtelldir (_WDIR*);
114 void __cdecl _wseekdir (_WDIR*, long);
117 #ifdef __cplusplus
119 #endif
121 #endif /* Not RC_INVOKED */
123 #endif /* Not _DIRENT_H_ */