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 | #include <stdio.h>
|
---|
12 | #include <io.h>
|
---|
13 |
|
---|
14 | #ifndef RC_INVOKED
|
---|
15 |
|
---|
16 | #ifdef __cplusplus
|
---|
17 | extern "C" {
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | struct dirent
|
---|
21 | {
|
---|
22 | long d_ino; /* Always zero. */
|
---|
23 | unsigned short d_reclen; /* Always zero. */
|
---|
24 | unsigned short d_namlen; /* Length of name in d_name. */
|
---|
25 | char d_name[FILENAME_MAX]; /* File name. */
|
---|
26 | };
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * This is an internal data structure. Good programmers will not use it
|
---|
30 | * except as an argument to one of the functions below.
|
---|
31 | * dd_stat field is now int (was short in older versions).
|
---|
32 | */
|
---|
33 | typedef struct
|
---|
34 | {
|
---|
35 | /* disk transfer area for this dir */
|
---|
36 | struct _finddata_t dd_dta;
|
---|
37 |
|
---|
38 | /* dirent struct to return from dir (NOTE: this makes this thread
|
---|
39 | * safe as long as only one thread uses a particular DIR struct at
|
---|
40 | * a time) */
|
---|
41 | struct dirent dd_dir;
|
---|
42 |
|
---|
43 | /* _findnext handle */
|
---|
44 | long dd_handle;
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * Status of search:
|
---|
48 | * 0 = not started yet (next entry to read is first entry)
|
---|
49 | * -1 = off the end
|
---|
50 | * positive = 0 based index of next entry
|
---|
51 | */
|
---|
52 | int dd_stat;
|
---|
53 |
|
---|
54 | /* given path for dir with search pattern (struct is extended) */
|
---|
55 | char dd_name[1];
|
---|
56 | } DIR;
|
---|
57 |
|
---|
58 | DIR* __cdecl opendir (const char*);
|
---|
59 | struct dirent* __cdecl readdir (DIR*);
|
---|
60 | int __cdecl closedir (DIR*);
|
---|
61 | void __cdecl rewinddir (DIR*);
|
---|
62 | long __cdecl telldir (DIR*);
|
---|
63 | void __cdecl seekdir (DIR*, long);
|
---|
64 |
|
---|
65 |
|
---|
66 | /* wide char versions */
|
---|
67 |
|
---|
68 | struct _wdirent
|
---|
69 | {
|
---|
70 | long d_ino; /* Always zero. */
|
---|
71 | unsigned short d_reclen; /* Always zero. */
|
---|
72 | unsigned short d_namlen; /* Length of name in d_name. */
|
---|
73 | wchar_t d_name[FILENAME_MAX]; /* File name. */
|
---|
74 | };
|
---|
75 |
|
---|
76 | /*
|
---|
77 | * This is an internal data structure. Good programmers will not use it
|
---|
78 | * except as an argument to one of the functions below.
|
---|
79 | */
|
---|
80 | typedef struct
|
---|
81 | {
|
---|
82 | /* disk transfer area for this dir */
|
---|
83 | struct _wfinddata_t dd_dta;
|
---|
84 |
|
---|
85 | /* dirent struct to return from dir (NOTE: this makes this thread
|
---|
86 | * safe as long as only one thread uses a particular DIR struct at
|
---|
87 | * a time) */
|
---|
88 | struct _wdirent dd_dir;
|
---|
89 |
|
---|
90 | /* _findnext handle */
|
---|
91 | long dd_handle;
|
---|
92 |
|
---|
93 | /*
|
---|
94 | * Status of search:
|
---|
95 | * 0 = not started yet (next entry to read is first entry)
|
---|
96 | * -1 = off the end
|
---|
97 | * positive = 0 based index of next entry
|
---|
98 | */
|
---|
99 | int dd_stat;
|
---|
100 |
|
---|
101 | /* given path for dir with search pattern (struct is extended) */
|
---|
102 | wchar_t dd_name[1];
|
---|
103 | } _WDIR;
|
---|
104 |
|
---|
105 |
|
---|
106 |
|
---|
107 | _WDIR* __cdecl _wopendir (const wchar_t*);
|
---|
108 | struct _wdirent* __cdecl _wreaddir (_WDIR*);
|
---|
109 | int __cdecl _wclosedir (_WDIR*);
|
---|
110 | void __cdecl _wrewinddir (_WDIR*);
|
---|
111 | long __cdecl _wtelldir (_WDIR*);
|
---|
112 | void __cdecl _wseekdir (_WDIR*, long);
|
---|
113 |
|
---|
114 |
|
---|
115 | #ifdef __cplusplus
|
---|
116 | }
|
---|
117 | #endif
|
---|
118 |
|
---|
119 | #endif /* Not RC_INVOKED */
|
---|
120 |
|
---|
121 | #endif /* Not _DIRENT_H_ */
|
---|