Code

(squash) test for previous
[git.git] / compat / vcbuild / include / dirent.h
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  *
6  * The mingw-runtime package and its code is distributed in the hope that it
7  * will be useful but WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESSED OR
8  * IMPLIED ARE HEREBY DISCLAIMED.  This includes but is not limited to
9  * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  *
11  * You are free to use this package and its code without limitation.
12  */
13 #ifndef _DIRENT_H_
14 #define _DIRENT_H_
15 #include <io.h>
17 #define PATH_MAX 512
19 #define __MINGW_NOTHROW
21 #ifndef RC_INVOKED
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
27 struct dirent
28 {
29         long            d_ino;          /* Always zero. */
30         unsigned short  d_reclen;       /* Always zero. */
31         unsigned short  d_namlen;       /* Length of name in d_name. */
32         char            d_name[FILENAME_MAX]; /* File name. */
33 };
35 /*
36  * This is an internal data structure. Good programmers will not use it
37  * except as an argument to one of the functions below.
38  * dd_stat field is now int (was short in older versions).
39  */
40 typedef struct
41 {
42         /* disk transfer area for this dir */
43         struct _finddata_t      dd_dta;
45         /* dirent struct to return from dir (NOTE: this makes this thread
46          * safe as long as only one thread uses a particular DIR struct at
47          * a time) */
48         struct dirent           dd_dir;
50         /* _findnext handle */
51         long                    dd_handle;
53         /*
54          * Status of search:
55          *   0 = not started yet (next entry to read is first entry)
56          *  -1 = off the end
57          *   positive = 0 based index of next entry
58          */
59         int                     dd_stat;
61         /* given path for dir with search pattern (struct is extended) */
62         char                    dd_name[PATH_MAX+3];
63 } DIR;
65 DIR* __cdecl __MINGW_NOTHROW opendir (const char*);
66 struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);
67 int __cdecl __MINGW_NOTHROW closedir (DIR*);
68 void __cdecl __MINGW_NOTHROW rewinddir (DIR*);
69 long __cdecl __MINGW_NOTHROW telldir (DIR*);
70 void __cdecl __MINGW_NOTHROW seekdir (DIR*, long);
73 /* wide char versions */
75 struct _wdirent
76 {
77         long            d_ino;          /* Always zero. */
78         unsigned short  d_reclen;       /* Always zero. */
79         unsigned short  d_namlen;       /* Length of name in d_name. */
80         wchar_t         d_name[FILENAME_MAX]; /* File name. */
81 };
83 /*
84  * This is an internal data structure. Good programmers will not use it
85  * except as an argument to one of the functions below.
86  */
87 typedef struct
88 {
89         /* disk transfer area for this dir */
90         //struct _wfinddata_t   dd_dta;
92         /* dirent struct to return from dir (NOTE: this makes this thread
93          * safe as long as only one thread uses a particular DIR struct at
94          * a time) */
95         struct _wdirent         dd_dir;
97         /* _findnext handle */
98         long                    dd_handle;
100         /*
101          * Status of search:
102          *   0 = not started yet (next entry to read is first entry)
103          *  -1 = off the end
104          *   positive = 0 based index of next entry
105          */
106         int                     dd_stat;
108         /* given path for dir with search pattern (struct is extended) */
109         wchar_t                 dd_name[1];
110 } _WDIR;
114 _WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);
115 struct _wdirent*  __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);
116 int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*);
117 void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*);
118 long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*);
119 void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long);
122 #ifdef  __cplusplus
124 #endif
126 #endif  /* Not RC_INVOKED */
128 #endif  /* Not _DIRENT_H_ */