1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A GNU-like <dirent.h>.
3    Copyright (C) 2006-2015 Free Software Foundation, Inc.
4 
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17 
18 #ifndef _GL_DIRENT_H
19 
20 #if __GNUC__ >= 3
21 #pragma GCC system_header
22 #endif
23 
24 
25 /* The include_next requires a split double-inclusion guard.  */
26 #if 1
27 # include_next <dirent.h>
28 #endif
29 
30 #ifndef _GL_DIRENT_H
31 #define _GL_DIRENT_H
32 
33 /* Get ino_t.  Needed on some systems, including glibc 2.8.  */
34 #include <sys/types.h>
35 
36 #if !1
37 /* Define types DIR and 'struct dirent'.  */
38 # if !GNULIB_defined_struct_dirent
39 struct dirent
40 {
41   char d_type;
42   char d_name[1];
43 };
44 /* Possible values for 'd_type'.  */
45 #  define DT_UNKNOWN 0
46 #  define DT_FIFO    1          /* FIFO */
47 #  define DT_CHR     2          /* character device */
48 #  define DT_DIR     4          /* directory */
49 #  define DT_BLK     6          /* block device */
50 #  define DT_REG     8          /* regular file */
51 #  define DT_LNK    10          /* symbolic link */
52 #  define DT_SOCK   12          /* socket */
53 #  define DT_WHT    14          /* whiteout */
54 typedef struct gl_directory DIR;
55 #  define GNULIB_defined_struct_dirent 1
56 # endif
57 #endif
58 
59 /* The __attribute__ feature is available in gcc versions 2.5 and later.
60    The attribute __pure__ was added in gcc 2.96.  */
61 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
62 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
63 #else
64 # define _GL_ATTRIBUTE_PURE /* empty */
65 #endif
66 
67 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
68 #ifndef _GL_CXXDEFS_H
69 #define _GL_CXXDEFS_H
70 
71 /* The three most frequent use cases of these macros are:
72 
73    * For providing a substitute for a function that is missing on some
74      platforms, but is declared and works fine on the platforms on which
75      it exists:
76 
77        #if @GNULIB_FOO@
78        # if !@HAVE_FOO@
79        _GL_FUNCDECL_SYS (foo, ...);
80        # endif
81        _GL_CXXALIAS_SYS (foo, ...);
82        _GL_CXXALIASWARN (foo);
83        #elif defined GNULIB_POSIXCHECK
84        ...
85        #endif
86 
87    * For providing a replacement for a function that exists on all platforms,
88      but is broken/insufficient and needs to be replaced on some platforms:
89 
90        #if @GNULIB_FOO@
91        # if @REPLACE_FOO@
92        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
93        #   undef foo
94        #   define foo rpl_foo
95        #  endif
96        _GL_FUNCDECL_RPL (foo, ...);
97        _GL_CXXALIAS_RPL (foo, ...);
98        # else
99        _GL_CXXALIAS_SYS (foo, ...);
100        # endif
101        _GL_CXXALIASWARN (foo);
102        #elif defined GNULIB_POSIXCHECK
103        ...
104        #endif
105 
106    * For providing a replacement for a function that exists on some platforms
107      but is broken/insufficient and needs to be replaced on some of them and
108      is additionally either missing or undeclared on some other platforms:
109 
110        #if @GNULIB_FOO@
111        # if @REPLACE_FOO@
112        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
113        #   undef foo
114        #   define foo rpl_foo
115        #  endif
116        _GL_FUNCDECL_RPL (foo, ...);
117        _GL_CXXALIAS_RPL (foo, ...);
118        # else
119        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
120        _GL_FUNCDECL_SYS (foo, ...);
121        #  endif
122        _GL_CXXALIAS_SYS (foo, ...);
123        # endif
124        _GL_CXXALIASWARN (foo);
125        #elif defined GNULIB_POSIXCHECK
126        ...
127        #endif
128 */
129 
130 /* _GL_EXTERN_C declaration;
131    performs the declaration with C linkage.  */
132 #if defined __cplusplus
133 # define _GL_EXTERN_C extern "C"
134 #else
135 # define _GL_EXTERN_C extern
136 #endif
137 
138 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
139    declares a replacement function, named rpl_func, with the given prototype,
140    consisting of return type, parameters, and attributes.
141    Example:
142      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
143                                   _GL_ARG_NONNULL ((1)));
144  */
145 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
146   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
147 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
148   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
149 
150 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
151    declares the system function, named func, with the given prototype,
152    consisting of return type, parameters, and attributes.
153    Example:
154      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
155                                   _GL_ARG_NONNULL ((1)));
156  */
157 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
158   _GL_EXTERN_C rettype func parameters_and_attributes
159 
160 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
161    declares a C++ alias called GNULIB_NAMESPACE::func
162    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
163    Example:
164      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
165  */
166 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
167   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
168 #if defined __cplusplus && defined GNULIB_NAMESPACE
169 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
170     namespace GNULIB_NAMESPACE                                \
171     {                                                         \
172       rettype (*const func) parameters = ::rpl_func;          \
173     }                                                         \
174     _GL_EXTERN_C int _gl_cxxalias_dummy
175 #else
176 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
177     _GL_EXTERN_C int _gl_cxxalias_dummy
178 #endif
179 
180 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
181    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
182    except that the C function rpl_func may have a slightly different
183    declaration.  A cast is used to silence the "invalid conversion" error
184    that would otherwise occur.  */
185 #if defined __cplusplus && defined GNULIB_NAMESPACE
186 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
187     namespace GNULIB_NAMESPACE                                     \
188     {                                                              \
189       rettype (*const func) parameters =                           \
190         reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
191     }                                                              \
192     _GL_EXTERN_C int _gl_cxxalias_dummy
193 #else
194 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
195     _GL_EXTERN_C int _gl_cxxalias_dummy
196 #endif
197 
198 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
199    declares a C++ alias called GNULIB_NAMESPACE::func
200    that redirects to the system provided function func, if GNULIB_NAMESPACE
201    is defined.
202    Example:
203      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
204  */
205 #if defined __cplusplus && defined GNULIB_NAMESPACE
206   /* If we were to write
207        rettype (*const func) parameters = ::func;
208      like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
209      better (remove an indirection through a 'static' pointer variable),
210      but then the _GL_CXXALIASWARN macro below would cause a warning not only
211      for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
212 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
213     namespace GNULIB_NAMESPACE                     \
214     {                                              \
215       static rettype (*func) parameters = ::func;  \
216     }                                              \
217     _GL_EXTERN_C int _gl_cxxalias_dummy
218 #else
219 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
220     _GL_EXTERN_C int _gl_cxxalias_dummy
221 #endif
222 
223 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
224    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
225    except that the C function func may have a slightly different declaration.
226    A cast is used to silence the "invalid conversion" error that would
227    otherwise occur.  */
228 #if defined __cplusplus && defined GNULIB_NAMESPACE
229 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
230     namespace GNULIB_NAMESPACE                          \
231     {                                                   \
232       static rettype (*func) parameters =               \
233         reinterpret_cast<rettype(*)parameters>(::func); \
234     }                                                   \
235     _GL_EXTERN_C int _gl_cxxalias_dummy
236 #else
237 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
238     _GL_EXTERN_C int _gl_cxxalias_dummy
239 #endif
240 
241 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
242    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
243    except that the C function is picked among a set of overloaded functions,
244    namely the one with rettype2 and parameters2.  Two consecutive casts
245    are used to silence the "cannot find a match" and "invalid conversion"
246    errors that would otherwise occur.  */
247 #if defined __cplusplus && defined GNULIB_NAMESPACE
248   /* The outer cast must be a reinterpret_cast.
249      The inner cast: When the function is defined as a set of overloaded
250      functions, it works as a static_cast<>, choosing the designated variant.
251      When the function is defined as a single variant, it works as a
252      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
253 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
254     namespace GNULIB_NAMESPACE                                                \
255     {                                                                         \
256       static rettype (*func) parameters =                                     \
257         reinterpret_cast<rettype(*)parameters>(                               \
258           (rettype2(*)parameters2)(::func));                                  \
259     }                                                                         \
260     _GL_EXTERN_C int _gl_cxxalias_dummy
261 #else
262 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
263     _GL_EXTERN_C int _gl_cxxalias_dummy
264 #endif
265 
266 /* _GL_CXXALIASWARN (func);
267    causes a warning to be emitted when ::func is used but not when
268    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
269    variants.  */
270 #if defined __cplusplus && defined GNULIB_NAMESPACE
271 # define _GL_CXXALIASWARN(func) \
272    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
273 # define _GL_CXXALIASWARN_1(func,namespace) \
274    _GL_CXXALIASWARN_2 (func, namespace)
275 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
276    we enable the warning only when not optimizing.  */
277 # if !__OPTIMIZE__
278 #  define _GL_CXXALIASWARN_2(func,namespace) \
279     _GL_WARN_ON_USE (func, \
280                      "The symbol ::" #func " refers to the system function. " \
281                      "Use " #namespace "::" #func " instead.")
282 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
283 #  define _GL_CXXALIASWARN_2(func,namespace) \
284      extern __typeof__ (func) func
285 # else
286 #  define _GL_CXXALIASWARN_2(func,namespace) \
287      _GL_EXTERN_C int _gl_cxxalias_dummy
288 # endif
289 #else
290 # define _GL_CXXALIASWARN(func) \
291     _GL_EXTERN_C int _gl_cxxalias_dummy
292 #endif
293 
294 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
295    causes a warning to be emitted when the given overloaded variant of ::func
296    is used but not when GNULIB_NAMESPACE::func is used.  */
297 #if defined __cplusplus && defined GNULIB_NAMESPACE
298 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
299    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
300                         GNULIB_NAMESPACE)
301 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
302    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
303 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
304    we enable the warning only when not optimizing.  */
305 # if !__OPTIMIZE__
306 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
307     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
308                          "The symbol ::" #func " refers to the system function. " \
309                          "Use " #namespace "::" #func " instead.")
310 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
311 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
312      extern __typeof__ (func) func
313 # else
314 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
315      _GL_EXTERN_C int _gl_cxxalias_dummy
316 # endif
317 #else
318 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
319     _GL_EXTERN_C int _gl_cxxalias_dummy
320 #endif
321 
322 #endif /* _GL_CXXDEFS_H */
323 
324 /* The definition of _GL_ARG_NONNULL is copied here.  */
325 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
326    that the values passed as arguments n, ..., m must be non-NULL pointers.
327    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
328 #ifndef _GL_ARG_NONNULL
329 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
330 #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
331 # else
332 #  define _GL_ARG_NONNULL(params)
333 # endif
334 #endif
335 
336 /* The definition of _GL_WARN_ON_USE is copied here.  */
337 #ifndef _GL_WARN_ON_USE
338 
339 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
340 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
341 #  define _GL_WARN_ON_USE(function, message) \
342 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
343 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
344 /* Verify the existence of the function.  */
345 #  define _GL_WARN_ON_USE(function, message) \
346 extern __typeof__ (function) function
347 # else /* Unsupported.  */
348 #  define _GL_WARN_ON_USE(function, message) \
349 _GL_WARN_EXTERN_C int _gl_warn_on_use
350 # endif
351 #endif
352 
353 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
354    is like _GL_WARN_ON_USE (function, "string"), except that the function is
355    declared with the given prototype, consisting of return type, parameters,
356    and attributes.
357    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
358    not work in this case.  */
359 #ifndef _GL_WARN_ON_USE_CXX
360 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
361 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
362 extern rettype function parameters_and_attributes \
363      __attribute__ ((__warning__ (msg)))
364 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
365 /* Verify the existence of the function.  */
366 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
367 extern rettype function parameters_and_attributes
368 # else /* Unsupported.  */
369 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
370 _GL_WARN_EXTERN_C int _gl_warn_on_use
371 # endif
372 #endif
373 
374 /* _GL_WARN_EXTERN_C declaration;
375    performs the declaration with C linkage.  */
376 #ifndef _GL_WARN_EXTERN_C
377 # if defined __cplusplus
378 #  define _GL_WARN_EXTERN_C extern "C"
379 # else
380 #  define _GL_WARN_EXTERN_C extern
381 # endif
382 #endif
383 
384 
385 /* Declare overridden functions.  */
386 
387 #if 1
388 # if 0
389 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
390 #   undef opendir
391 #   define opendir rpl_opendir
392 #   define GNULIB_defined_opendir 1
393 #  endif
394 _GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
395 _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
396 # else
397 #  if !1
398 _GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1)));
399 #  endif
400 _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
401 # endif
402 _GL_CXXALIASWARN (opendir);
403 #elif defined GNULIB_POSIXCHECK
404 # undef opendir
405 # if HAVE_RAW_DECL_OPENDIR
406 _GL_WARN_ON_USE (opendir, "opendir is not portable - "
407                  "use gnulib module opendir for portability");
408 # endif
409 #endif
410 
411 #if 1
412 # if !1
413 _GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1)));
414 # endif
415 _GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp));
416 _GL_CXXALIASWARN (readdir);
417 #elif defined GNULIB_POSIXCHECK
418 # undef readdir
419 # if HAVE_RAW_DECL_READDIR
420 _GL_WARN_ON_USE (readdir, "readdir is not portable - "
421                  "use gnulib module readdir for portability");
422 # endif
423 #endif
424 
425 #if 0
426 # if !1
427 _GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1)));
428 # endif
429 _GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp));
430 _GL_CXXALIASWARN (rewinddir);
431 #elif defined GNULIB_POSIXCHECK
432 # undef rewinddir
433 # if HAVE_RAW_DECL_REWINDDIR
434 _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
435                  "use gnulib module rewinddir for portability");
436 # endif
437 #endif
438 
439 #if 1
440 # if 0
441 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
442 #   undef closedir
443 #   define closedir rpl_closedir
444 #   define GNULIB_defined_closedir 1
445 #  endif
446 _GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
447 _GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
448 # else
449 #  if !1
450 _GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
451 #  endif
452 _GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
453 # endif
454 _GL_CXXALIASWARN (closedir);
455 #elif defined GNULIB_POSIXCHECK
456 # undef closedir
457 # if HAVE_RAW_DECL_CLOSEDIR
458 _GL_WARN_ON_USE (closedir, "closedir is not portable - "
459                  "use gnulib module closedir for portability");
460 # endif
461 #endif
462 
463 #if 1
464 /* Return the file descriptor associated with the given directory stream,
465    or -1 if none exists.  */
466 # if 0
467 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
468 #   undef dirfd
469 #   define dirfd rpl_dirfd
470 #  endif
471 _GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
472 _GL_CXXALIAS_RPL (dirfd, int, (DIR *));
473 # else
474 #  if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd
475     /* dirfd is defined as a macro and not as a function.
476        Turn it into a function and get rid of the macro.  */
477 static inline int (dirfd) (DIR *dp) { return dirfd (dp); }
478 #   undef dirfd
479 #  endif
480 #  if !(1 || defined dirfd)
481 _GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
482 #  endif
483 _GL_CXXALIAS_SYS (dirfd, int, (DIR *));
484 # endif
485 _GL_CXXALIASWARN (dirfd);
486 #elif defined GNULIB_POSIXCHECK
487 # undef dirfd
488 # if HAVE_RAW_DECL_DIRFD
489 _GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
490                  "use gnulib module dirfd for portability");
491 # endif
492 #endif
493 
494 #if 1
495 /* Open a directory stream visiting the given directory file
496    descriptor.  Return NULL and set errno if fd is not visiting a
497    directory.  On success, this function consumes fd (it will be
498    implicitly closed either by this function or by a subsequent
499    closedir).  */
500 # if 0
501 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
502 #   undef fdopendir
503 #   define fdopendir rpl_fdopendir
504 #  endif
505 _GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd));
506 _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
507 # else
508 #  if !1 || !1
509 _GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd));
510 #  endif
511 _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
512 # endif
513 _GL_CXXALIASWARN (fdopendir);
514 #elif defined GNULIB_POSIXCHECK
515 # undef fdopendir
516 # if HAVE_RAW_DECL_FDOPENDIR
517 _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
518                  "use gnulib module fdopendir for portability");
519 # endif
520 #endif
521 
522 #if 0
523 /* Scan the directory DIR, calling FILTER on each directory entry.
524    Entries for which FILTER returns nonzero are individually malloc'd,
525    sorted using qsort with CMP, and collected in a malloc'd array in
526    *NAMELIST.  Returns the number of entries selected, or -1 on error.  */
527 # if !1
528 _GL_FUNCDECL_SYS (scandir, int,
529                   (const char *dir, struct dirent ***namelist,
530                    int (*filter) (const struct dirent *),
531                    int (*cmp) (const struct dirent **, const struct dirent **))
532                   _GL_ARG_NONNULL ((1, 2, 4)));
533 # endif
534 /* Need to cast, because on glibc systems, the fourth parameter is
535                         int (*cmp) (const void *, const void *).  */
536 _GL_CXXALIAS_SYS_CAST (scandir, int,
537                        (const char *dir, struct dirent ***namelist,
538                         int (*filter) (const struct dirent *),
539                         int (*cmp) (const struct dirent **, const struct dirent **)));
540 _GL_CXXALIASWARN (scandir);
541 #elif defined GNULIB_POSIXCHECK
542 # undef scandir
543 # if HAVE_RAW_DECL_SCANDIR
544 _GL_WARN_ON_USE (scandir, "scandir is unportable - "
545                  "use gnulib module scandir for portability");
546 # endif
547 #endif
548 
549 #if 0
550 /* Compare two 'struct dirent' entries alphabetically.  */
551 # if !1
552 _GL_FUNCDECL_SYS (alphasort, int,
553                   (const struct dirent **, const struct dirent **)
554                   _GL_ATTRIBUTE_PURE
555                   _GL_ARG_NONNULL ((1, 2)));
556 # endif
557 /* Need to cast, because on glibc systems, the parameters are
558                        (const void *, const void *).  */
559 _GL_CXXALIAS_SYS_CAST (alphasort, int,
560                        (const struct dirent **, const struct dirent **));
561 _GL_CXXALIASWARN (alphasort);
562 #elif defined GNULIB_POSIXCHECK
563 # undef alphasort
564 # if HAVE_RAW_DECL_ALPHASORT
565 _GL_WARN_ON_USE (alphasort, "alphasort is unportable - "
566                  "use gnulib module alphasort for portability");
567 # endif
568 #endif
569 
570 
571 #endif /* _GL_DIRENT_H */
572 #endif /* _GL_DIRENT_H */
573