Fossil SCM

Update <dirent.h> for Visual Studio to latest version 1.21 (September 2015)

jan.nijtmans 2016-04-13 08:19 trunk
Commit dd498bbac7f8cf96a4fd4fad234673a582c0850c
1 file changed +154 -75
--- win/include/dirent.h
+++ win/include/dirent.h
@@ -1,30 +1,13 @@
11
/*
2
- * dirent.h - dirent API for Microsoft Visual Studio
2
+ * Dirent interface for Microsoft Visual Studio
3
+ * Version 1.21
34
*
45
* Copyright (C) 2006-2012 Toni Ronkko
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining
7
- * a copy of this software and associated documentation files (the
8
- * ``Software''), to deal in the Software without restriction, including
9
- * without limitation the rights to use, copy, modify, merge, publish,
10
- * distribute, sublicense, and/or sell copies of the Software, and to
11
- * permit persons to whom the Software is furnished to do so, subject to
12
- * the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included
15
- * in all copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
- * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
21
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
- * OTHER DEALINGS IN THE SOFTWARE.
24
- *
25
- * $Id: dirent.h,v 1.20 2014/03/19 17:52:23 tronkko Exp $
6
+ * This file is part of dirent. Dirent may be freely distributed
7
+ * under the MIT license. For all details and documentation, see
8
+ * https://github.com/tronkko/dirent
269
*/
2710
#ifndef DIRENT_H
2811
#define DIRENT_H
2912
3013
/*
@@ -60,58 +43,113 @@
6043
/* Entries missing from MSVC 6.0 */
6144
#if !defined(FILE_ATTRIBUTE_DEVICE)
6245
# define FILE_ATTRIBUTE_DEVICE 0x40
6346
#endif
6447
65
-/* File type and permission flags for stat() */
48
+/* File type and permission flags for stat(), general mask */
6649
#if !defined(S_IFMT)
67
-# define S_IFMT _S_IFMT /* File type mask */
50
+# define S_IFMT _S_IFMT
6851
#endif
52
+
53
+/* Directory bit */
6954
#if !defined(S_IFDIR)
70
-# define S_IFDIR _S_IFDIR /* Directory */
55
+# define S_IFDIR _S_IFDIR
7156
#endif
57
+
58
+/* Character device bit */
7259
#if !defined(S_IFCHR)
73
-# define S_IFCHR _S_IFCHR /* Character device */
60
+# define S_IFCHR _S_IFCHR
7461
#endif
62
+
63
+/* Pipe bit */
7564
#if !defined(S_IFFIFO)
76
-# define S_IFFIFO _S_IFFIFO /* Pipe */
65
+# define S_IFFIFO _S_IFFIFO
7766
#endif
67
+
68
+/* Regular file bit */
7869
#if !defined(S_IFREG)
79
-# define S_IFREG _S_IFREG /* Regular file */
70
+# define S_IFREG _S_IFREG
8071
#endif
72
+
73
+/* Read permission */
8174
#if !defined(S_IREAD)
82
-# define S_IREAD _S_IREAD /* Read permission */
75
+# define S_IREAD _S_IREAD
8376
#endif
77
+
78
+/* Write permission */
8479
#if !defined(S_IWRITE)
85
-# define S_IWRITE _S_IWRITE /* Write permission */
80
+# define S_IWRITE _S_IWRITE
8681
#endif
82
+
83
+/* Execute permission */
8784
#if !defined(S_IEXEC)
88
-# define S_IEXEC _S_IEXEC /* Execute permission */
85
+# define S_IEXEC _S_IEXEC
8986
#endif
87
+
88
+/* Pipe */
9089
#if !defined(S_IFIFO)
91
-# define S_IFIFO _S_IFIFO /* Pipe */
90
+# define S_IFIFO _S_IFIFO
9291
#endif
92
+
93
+/* Block device */
9394
#if !defined(S_IFBLK)
94
-# define S_IFBLK 0 /* Block device */
95
+# define S_IFBLK 0
9596
#endif
97
+
98
+/* Link */
9699
#if !defined(S_IFLNK)
97
-# define S_IFLNK 0 /* Link */
100
+# define S_IFLNK 0
98101
#endif
102
+
103
+/* Socket */
99104
#if !defined(S_IFSOCK)
100
-# define S_IFSOCK 0 /* Socket */
105
+# define S_IFSOCK 0
106
+#endif
107
+
108
+/* Read user permission */
109
+#if !defined(S_IRUSR)
110
+# define S_IRUSR S_IREAD
111
+#endif
112
+
113
+/* Write user permission */
114
+#if !defined(S_IWUSR)
115
+# define S_IWUSR S_IWRITE
116
+#endif
117
+
118
+/* Execute user permission */
119
+#if !defined(S_IXUSR)
120
+# define S_IXUSR 0
121
+#endif
122
+
123
+/* Read group permission */
124
+#if !defined(S_IRGRP)
125
+# define S_IRGRP 0
126
+#endif
127
+
128
+/* Write group permission */
129
+#if !defined(S_IWGRP)
130
+# define S_IWGRP 0
131
+#endif
132
+
133
+/* Execute group permission */
134
+#if !defined(S_IXGRP)
135
+# define S_IXGRP 0
136
+#endif
137
+
138
+/* Read others permission */
139
+#if !defined(S_IROTH)
140
+# define S_IROTH 0
141
+#endif
142
+
143
+/* Write others permission */
144
+#if !defined(S_IWOTH)
145
+# define S_IWOTH 0
101146
#endif
102147
103
-#if defined(_MSC_VER)
104
-# define S_IRUSR S_IREAD /* Read user */
105
-# define S_IWUSR S_IWRITE /* Write user */
106
-# define S_IXUSR 0 /* Execute user */
107
-# define S_IRGRP 0 /* Read group */
108
-# define S_IWGRP 0 /* Write group */
109
-# define S_IXGRP 0 /* Execute group */
110
-# define S_IROTH 0 /* Read others */
111
-# define S_IWOTH 0 /* Write others */
112
-# define S_IXOTH 0 /* Execute others */
148
+/* Execute others permission */
149
+#if !defined(S_IXOTH)
150
+# define S_IXOTH 0
113151
#endif
114152
115153
/* Maximum length of file name */
116154
#if !defined(PATH_MAX)
117155
# define PATH_MAX MAX_PATH
@@ -122,18 +160,18 @@
122160
#if !defined(NAME_MAX)
123161
# define NAME_MAX FILENAME_MAX
124162
#endif
125163
126164
/* File type flags for d_type */
127
-#define DT_UNKNOWN 0
128
-#define DT_REG S_IFREG
129
-#define DT_DIR S_IFDIR
130
-#define DT_FIFO S_IFIFO
131
-#define DT_SOCK S_IFSOCK
132
-#define DT_CHR S_IFCHR
133
-#define DT_BLK S_IFBLK
134
-#define DT_LNK S_IFLNK
165
+#define DT_UNKNOWN 0
166
+#define DT_REG S_IFREG
167
+#define DT_DIR S_IFDIR
168
+#define DT_FIFO S_IFIFO
169
+#define DT_SOCK S_IFSOCK
170
+#define DT_CHR S_IFCHR
171
+#define DT_BLK S_IFBLK
172
+#define DT_LNK S_IFLNK
135173
136174
/* Macros for converting between st_mode and d_type */
137175
#define IFTODT(mode) ((mode) & S_IFMT)
138176
#define DTTOIF(type) (type)
139177
@@ -141,17 +179,31 @@
141179
* File type macros. Note that block devices, sockets and links cannot be
142180
* distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
143181
* only defined for compatibility. These macros should always return false
144182
* on Windows.
145183
*/
146
-#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
147
-#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
148
-#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
149
-#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
150
-#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
151
-#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
152
-#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
184
+#if !defined(S_ISFIFO)
185
+# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
186
+#endif
187
+#if !defined(S_ISDIR)
188
+# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
189
+#endif
190
+#if !defined(S_ISREG)
191
+# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
192
+#endif
193
+#if !defined(S_ISLNK)
194
+# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
195
+#endif
196
+#if !defined(S_ISSOCK)
197
+# define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
198
+#endif
199
+#if !defined(S_ISCHR)
200
+# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
201
+#endif
202
+#if !defined(S_ISBLK)
203
+# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
204
+#endif
153205
154206
/* Return the exact length of d_namlen without zero terminator */
155207
#define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
156208
157209
/* Return number of bytes needed to store d_namlen */
@@ -163,24 +215,42 @@
163215
#endif
164216
165217
166218
/* Wide-character version */
167219
struct _wdirent {
168
- long d_ino; /* Always zero */
169
- unsigned short d_reclen; /* Structure size */
170
- size_t d_namlen; /* Length of name without \0 */
171
- int d_type; /* File type */
172
- wchar_t d_name[PATH_MAX]; /* File name */
220
+ /* Always zero */
221
+ long d_ino;
222
+
223
+ /* Structure size */
224
+ unsigned short d_reclen;
225
+
226
+ /* Length of name without \0 */
227
+ size_t d_namlen;
228
+
229
+ /* File type */
230
+ int d_type;
231
+
232
+ /* File name */
233
+ wchar_t d_name[PATH_MAX];
173234
};
174235
typedef struct _wdirent _wdirent;
175236
176237
struct _WDIR {
177
- struct _wdirent ent; /* Current directory entry */
178
- WIN32_FIND_DATAW data; /* Private file data */
179
- int cached; /* True if data is valid */
180
- HANDLE handle; /* Win32 search handle */
181
- wchar_t *patt; /* Initial directory name */
238
+ /* Current directory entry */
239
+ struct _wdirent ent;
240
+
241
+ /* Private file data */
242
+ WIN32_FIND_DATAW data;
243
+
244
+ /* True if data is valid */
245
+ int cached;
246
+
247
+ /* Win32 search handle */
248
+ HANDLE handle;
249
+
250
+ /* Initial directory name */
251
+ wchar_t *patt;
182252
};
183253
typedef struct _WDIR _WDIR;
184254
185255
static _WDIR *_wopendir (const wchar_t *dirname);
186256
static struct _wdirent *_wreaddir (_WDIR *dirp);
@@ -197,15 +267,24 @@
197267
#define wrewinddir _wrewinddir
198268
199269
200270
/* Multi-byte character versions */
201271
struct dirent {
202
- long d_ino; /* Always zero */
203
- unsigned short d_reclen; /* Structure size */
204
- size_t d_namlen; /* Length of name without \0 */
205
- int d_type; /* File type */
206
- char d_name[PATH_MAX]; /* File name */
272
+ /* Always zero */
273
+ long d_ino;
274
+
275
+ /* Structure size */
276
+ unsigned short d_reclen;
277
+
278
+ /* Length of name without \0 */
279
+ size_t d_namlen;
280
+
281
+ /* File type */
282
+ int d_type;
283
+
284
+ /* File name */
285
+ char d_name[PATH_MAX];
207286
};
208287
typedef struct dirent dirent;
209288
210289
struct DIR {
211290
struct dirent ent;
212291
--- win/include/dirent.h
+++ win/include/dirent.h
@@ -1,30 +1,13 @@
1 /*
2 * dirent.h - dirent API for Microsoft Visual Studio
 
3 *
4 * Copyright (C) 2006-2012 Toni Ronkko
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * ``Software''), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 *
25 * $Id: dirent.h,v 1.20 2014/03/19 17:52:23 tronkko Exp $
26 */
27 #ifndef DIRENT_H
28 #define DIRENT_H
29
30 /*
@@ -60,58 +43,113 @@
60 /* Entries missing from MSVC 6.0 */
61 #if !defined(FILE_ATTRIBUTE_DEVICE)
62 # define FILE_ATTRIBUTE_DEVICE 0x40
63 #endif
64
65 /* File type and permission flags for stat() */
66 #if !defined(S_IFMT)
67 # define S_IFMT _S_IFMT /* File type mask */
68 #endif
 
 
69 #if !defined(S_IFDIR)
70 # define S_IFDIR _S_IFDIR /* Directory */
71 #endif
 
 
72 #if !defined(S_IFCHR)
73 # define S_IFCHR _S_IFCHR /* Character device */
74 #endif
 
 
75 #if !defined(S_IFFIFO)
76 # define S_IFFIFO _S_IFFIFO /* Pipe */
77 #endif
 
 
78 #if !defined(S_IFREG)
79 # define S_IFREG _S_IFREG /* Regular file */
80 #endif
 
 
81 #if !defined(S_IREAD)
82 # define S_IREAD _S_IREAD /* Read permission */
83 #endif
 
 
84 #if !defined(S_IWRITE)
85 # define S_IWRITE _S_IWRITE /* Write permission */
86 #endif
 
 
87 #if !defined(S_IEXEC)
88 # define S_IEXEC _S_IEXEC /* Execute permission */
89 #endif
 
 
90 #if !defined(S_IFIFO)
91 # define S_IFIFO _S_IFIFO /* Pipe */
92 #endif
 
 
93 #if !defined(S_IFBLK)
94 # define S_IFBLK 0 /* Block device */
95 #endif
 
 
96 #if !defined(S_IFLNK)
97 # define S_IFLNK 0 /* Link */
98 #endif
 
 
99 #if !defined(S_IFSOCK)
100 # define S_IFSOCK 0 /* Socket */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101 #endif
102
103 #if defined(_MSC_VER)
104 # define S_IRUSR S_IREAD /* Read user */
105 # define S_IWUSR S_IWRITE /* Write user */
106 # define S_IXUSR 0 /* Execute user */
107 # define S_IRGRP 0 /* Read group */
108 # define S_IWGRP 0 /* Write group */
109 # define S_IXGRP 0 /* Execute group */
110 # define S_IROTH 0 /* Read others */
111 # define S_IWOTH 0 /* Write others */
112 # define S_IXOTH 0 /* Execute others */
113 #endif
114
115 /* Maximum length of file name */
116 #if !defined(PATH_MAX)
117 # define PATH_MAX MAX_PATH
@@ -122,18 +160,18 @@
122 #if !defined(NAME_MAX)
123 # define NAME_MAX FILENAME_MAX
124 #endif
125
126 /* File type flags for d_type */
127 #define DT_UNKNOWN 0
128 #define DT_REG S_IFREG
129 #define DT_DIR S_IFDIR
130 #define DT_FIFO S_IFIFO
131 #define DT_SOCK S_IFSOCK
132 #define DT_CHR S_IFCHR
133 #define DT_BLK S_IFBLK
134 #define DT_LNK S_IFLNK
135
136 /* Macros for converting between st_mode and d_type */
137 #define IFTODT(mode) ((mode) & S_IFMT)
138 #define DTTOIF(type) (type)
139
@@ -141,17 +179,31 @@
141 * File type macros. Note that block devices, sockets and links cannot be
142 * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
143 * only defined for compatibility. These macros should always return false
144 * on Windows.
145 */
146 #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
147 #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
148 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
149 #define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
150 #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
151 #define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
152 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
154 /* Return the exact length of d_namlen without zero terminator */
155 #define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
156
157 /* Return number of bytes needed to store d_namlen */
@@ -163,24 +215,42 @@
163 #endif
164
165
166 /* Wide-character version */
167 struct _wdirent {
168 long d_ino; /* Always zero */
169 unsigned short d_reclen; /* Structure size */
170 size_t d_namlen; /* Length of name without \0 */
171 int d_type; /* File type */
172 wchar_t d_name[PATH_MAX]; /* File name */
 
 
 
 
 
 
 
 
 
173 };
174 typedef struct _wdirent _wdirent;
175
176 struct _WDIR {
177 struct _wdirent ent; /* Current directory entry */
178 WIN32_FIND_DATAW data; /* Private file data */
179 int cached; /* True if data is valid */
180 HANDLE handle; /* Win32 search handle */
181 wchar_t *patt; /* Initial directory name */
 
 
 
 
 
 
 
 
 
182 };
183 typedef struct _WDIR _WDIR;
184
185 static _WDIR *_wopendir (const wchar_t *dirname);
186 static struct _wdirent *_wreaddir (_WDIR *dirp);
@@ -197,15 +267,24 @@
197 #define wrewinddir _wrewinddir
198
199
200 /* Multi-byte character versions */
201 struct dirent {
202 long d_ino; /* Always zero */
203 unsigned short d_reclen; /* Structure size */
204 size_t d_namlen; /* Length of name without \0 */
205 int d_type; /* File type */
206 char d_name[PATH_MAX]; /* File name */
 
 
 
 
 
 
 
 
 
207 };
208 typedef struct dirent dirent;
209
210 struct DIR {
211 struct dirent ent;
212
--- win/include/dirent.h
+++ win/include/dirent.h
@@ -1,30 +1,13 @@
1 /*
2 * Dirent interface for Microsoft Visual Studio
3 * Version 1.21
4 *
5 * Copyright (C) 2006-2012 Toni Ronkko
6 * This file is part of dirent. Dirent may be freely distributed
7 * under the MIT license. For all details and documentation, see
8 * https://github.com/tronkko/dirent
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9 */
10 #ifndef DIRENT_H
11 #define DIRENT_H
12
13 /*
@@ -60,58 +43,113 @@
43 /* Entries missing from MSVC 6.0 */
44 #if !defined(FILE_ATTRIBUTE_DEVICE)
45 # define FILE_ATTRIBUTE_DEVICE 0x40
46 #endif
47
48 /* File type and permission flags for stat(), general mask */
49 #if !defined(S_IFMT)
50 # define S_IFMT _S_IFMT
51 #endif
52
53 /* Directory bit */
54 #if !defined(S_IFDIR)
55 # define S_IFDIR _S_IFDIR
56 #endif
57
58 /* Character device bit */
59 #if !defined(S_IFCHR)
60 # define S_IFCHR _S_IFCHR
61 #endif
62
63 /* Pipe bit */
64 #if !defined(S_IFFIFO)
65 # define S_IFFIFO _S_IFFIFO
66 #endif
67
68 /* Regular file bit */
69 #if !defined(S_IFREG)
70 # define S_IFREG _S_IFREG
71 #endif
72
73 /* Read permission */
74 #if !defined(S_IREAD)
75 # define S_IREAD _S_IREAD
76 #endif
77
78 /* Write permission */
79 #if !defined(S_IWRITE)
80 # define S_IWRITE _S_IWRITE
81 #endif
82
83 /* Execute permission */
84 #if !defined(S_IEXEC)
85 # define S_IEXEC _S_IEXEC
86 #endif
87
88 /* Pipe */
89 #if !defined(S_IFIFO)
90 # define S_IFIFO _S_IFIFO
91 #endif
92
93 /* Block device */
94 #if !defined(S_IFBLK)
95 # define S_IFBLK 0
96 #endif
97
98 /* Link */
99 #if !defined(S_IFLNK)
100 # define S_IFLNK 0
101 #endif
102
103 /* Socket */
104 #if !defined(S_IFSOCK)
105 # define S_IFSOCK 0
106 #endif
107
108 /* Read user permission */
109 #if !defined(S_IRUSR)
110 # define S_IRUSR S_IREAD
111 #endif
112
113 /* Write user permission */
114 #if !defined(S_IWUSR)
115 # define S_IWUSR S_IWRITE
116 #endif
117
118 /* Execute user permission */
119 #if !defined(S_IXUSR)
120 # define S_IXUSR 0
121 #endif
122
123 /* Read group permission */
124 #if !defined(S_IRGRP)
125 # define S_IRGRP 0
126 #endif
127
128 /* Write group permission */
129 #if !defined(S_IWGRP)
130 # define S_IWGRP 0
131 #endif
132
133 /* Execute group permission */
134 #if !defined(S_IXGRP)
135 # define S_IXGRP 0
136 #endif
137
138 /* Read others permission */
139 #if !defined(S_IROTH)
140 # define S_IROTH 0
141 #endif
142
143 /* Write others permission */
144 #if !defined(S_IWOTH)
145 # define S_IWOTH 0
146 #endif
147
148 /* Execute others permission */
149 #if !defined(S_IXOTH)
150 # define S_IXOTH 0
 
 
 
 
 
 
 
151 #endif
152
153 /* Maximum length of file name */
154 #if !defined(PATH_MAX)
155 # define PATH_MAX MAX_PATH
@@ -122,18 +160,18 @@
160 #if !defined(NAME_MAX)
161 # define NAME_MAX FILENAME_MAX
162 #endif
163
164 /* File type flags for d_type */
165 #define DT_UNKNOWN 0
166 #define DT_REG S_IFREG
167 #define DT_DIR S_IFDIR
168 #define DT_FIFO S_IFIFO
169 #define DT_SOCK S_IFSOCK
170 #define DT_CHR S_IFCHR
171 #define DT_BLK S_IFBLK
172 #define DT_LNK S_IFLNK
173
174 /* Macros for converting between st_mode and d_type */
175 #define IFTODT(mode) ((mode) & S_IFMT)
176 #define DTTOIF(type) (type)
177
@@ -141,17 +179,31 @@
179 * File type macros. Note that block devices, sockets and links cannot be
180 * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
181 * only defined for compatibility. These macros should always return false
182 * on Windows.
183 */
184 #if !defined(S_ISFIFO)
185 # define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
186 #endif
187 #if !defined(S_ISDIR)
188 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
189 #endif
190 #if !defined(S_ISREG)
191 # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
192 #endif
193 #if !defined(S_ISLNK)
194 # define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
195 #endif
196 #if !defined(S_ISSOCK)
197 # define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
198 #endif
199 #if !defined(S_ISCHR)
200 # define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
201 #endif
202 #if !defined(S_ISBLK)
203 # define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
204 #endif
205
206 /* Return the exact length of d_namlen without zero terminator */
207 #define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
208
209 /* Return number of bytes needed to store d_namlen */
@@ -163,24 +215,42 @@
215 #endif
216
217
218 /* Wide-character version */
219 struct _wdirent {
220 /* Always zero */
221 long d_ino;
222
223 /* Structure size */
224 unsigned short d_reclen;
225
226 /* Length of name without \0 */
227 size_t d_namlen;
228
229 /* File type */
230 int d_type;
231
232 /* File name */
233 wchar_t d_name[PATH_MAX];
234 };
235 typedef struct _wdirent _wdirent;
236
237 struct _WDIR {
238 /* Current directory entry */
239 struct _wdirent ent;
240
241 /* Private file data */
242 WIN32_FIND_DATAW data;
243
244 /* True if data is valid */
245 int cached;
246
247 /* Win32 search handle */
248 HANDLE handle;
249
250 /* Initial directory name */
251 wchar_t *patt;
252 };
253 typedef struct _WDIR _WDIR;
254
255 static _WDIR *_wopendir (const wchar_t *dirname);
256 static struct _wdirent *_wreaddir (_WDIR *dirp);
@@ -197,15 +267,24 @@
267 #define wrewinddir _wrewinddir
268
269
270 /* Multi-byte character versions */
271 struct dirent {
272 /* Always zero */
273 long d_ino;
274
275 /* Structure size */
276 unsigned short d_reclen;
277
278 /* Length of name without \0 */
279 size_t d_namlen;
280
281 /* File type */
282 int d_type;
283
284 /* File name */
285 char d_name[PATH_MAX];
286 };
287 typedef struct dirent dirent;
288
289 struct DIR {
290 struct dirent ent;
291

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button