|
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. |
|
6 * |
|
7 */ |
|
8 #ifndef _DIRENT_H_ |
|
9 #define _DIRENT_H_ |
|
10 |
|
11 /* All the headers include this file. */ |
|
12 #include <_mingw.h> |
|
13 |
|
14 #include <io.h> |
|
15 |
|
16 #ifndef RC_INVOKED |
|
17 |
|
18 #ifdef __cplusplus |
|
19 extern "C" { |
|
20 #endif |
|
21 |
|
22 struct dirent |
|
23 { |
|
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. */ |
|
28 }; |
|
29 |
|
30 /* |
|
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). |
|
34 */ |
|
35 typedef struct |
|
36 { |
|
37 /* disk transfer area for this dir */ |
|
38 struct _finddata_t dd_dta; |
|
39 |
|
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; |
|
44 |
|
45 /* _findnext handle */ |
|
46 long dd_handle; |
|
47 |
|
48 /* |
|
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 |
|
53 */ |
|
54 int dd_stat; |
|
55 |
|
56 /* given path for dir with search pattern (struct is extended) */ |
|
57 char dd_name[1]; |
|
58 } DIR; |
|
59 |
|
60 DIR* __cdecl __MINGW_NOTHROW opendir (const char*); |
|
61 struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*); |
|
62 int __cdecl __MINGW_NOTHROW closedir (DIR*); |
|
63 void __cdecl __MINGW_NOTHROW rewinddir (DIR*); |
|
64 long __cdecl __MINGW_NOTHROW telldir (DIR*); |
|
65 void __cdecl __MINGW_NOTHROW seekdir (DIR*, long); |
|
66 |
|
67 |
|
68 /* wide char versions */ |
|
69 |
|
70 struct _wdirent |
|
71 { |
|
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. */ |
|
76 }; |
|
77 |
|
78 /* |
|
79 * This is an internal data structure. Good programmers will not use it |
|
80 * except as an argument to one of the functions below. |
|
81 */ |
|
82 typedef struct |
|
83 { |
|
84 /* disk transfer area for this dir */ |
|
85 struct _wfinddata_t dd_dta; |
|
86 |
|
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; |
|
91 |
|
92 /* _findnext handle */ |
|
93 long dd_handle; |
|
94 |
|
95 /* |
|
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 |
|
100 */ |
|
101 int dd_stat; |
|
102 |
|
103 /* given path for dir with search pattern (struct is extended) */ |
|
104 wchar_t dd_name[1]; |
|
105 } _WDIR; |
|
106 |
|
107 |
|
108 |
|
109 _WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*); |
|
110 struct _wdirent* __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*); |
|
111 int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*); |
|
112 void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*); |
|
113 long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*); |
|
114 void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long); |
|
115 |
|
116 |
|
117 #ifdef __cplusplus |
|
118 } |
|
119 #endif |
|
120 |
|
121 #endif /* Not RC_INVOKED */ |
|
122 |
|
123 #endif /* Not _DIRENT_H_ */ |