Mercurial > gnulib
annotate lib/dirent.in.h @ 40203:30d91797009f
autoupdate
author | Karl Berry <karl@freefriends.org> |
---|---|
date | Fri, 01 Mar 2019 08:42:42 -0800 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
10659 | 1 /* A GNU-like <dirent.h>. |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
2 Copyright (C) 2006-2019 Free Software Foundation, Inc. |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9246
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9246
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9246
diff
changeset
|
7 (at your option) any later version. |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 GNU General Public License for more details. |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
19190 | 15 along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
17 #ifndef _@GUARD_PREFIX@_DIRENT_H |
13094
2ed0fc659db8
Emit #pragma system_header after the inclusion guard, not before.
Bruno Haible <bruno@clisp.org>
parents:
13055
diff
changeset
|
18 |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
19 #if __GNUC__ >= 3 |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
20 @PRAGMA_SYSTEM_HEADER@ |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
21 #endif |
13761
a19ace3ba849
Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents:
13627
diff
changeset
|
22 @PRAGMA_COLUMNS@ |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
23 |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 /* The include_next requires a split double-inclusion guard. */ |
15603
550b8b7d6140
dirent: Don't assume <dirent.h> exists.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
25 #if @HAVE_DIRENT_H@ |
550b8b7d6140
dirent: Don't assume <dirent.h> exists.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
26 # @INCLUDE_NEXT@ @NEXT_DIRENT_H@ |
550b8b7d6140
dirent: Don't assume <dirent.h> exists.
Bruno Haible <bruno@clisp.org>
parents:
14840
diff
changeset
|
27 #endif |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
29 #ifndef _@GUARD_PREFIX@_DIRENT_H |
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
30 #define _@GUARD_PREFIX@_DIRENT_H |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 |
12601
c858b5287964
dirent: Document the last fix.
Bruno Haible <bruno@clisp.org>
parents:
12588
diff
changeset
|
32 /* Get ino_t. Needed on some systems, including glibc 2.8. */ |
12588 | 33 #include <sys/types.h> |
34 | |
15610
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
35 #if !@HAVE_DIRENT_H@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
36 /* Define types DIR and 'struct dirent'. */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
37 # if !GNULIB_defined_struct_dirent |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
38 struct dirent |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
39 { |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
40 char d_type; |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
41 char d_name[1]; |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
42 }; |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
43 /* Possible values for 'd_type'. */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
44 # define DT_UNKNOWN 0 |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
45 # define DT_FIFO 1 /* FIFO */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
46 # define DT_CHR 2 /* character device */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
47 # define DT_DIR 4 /* directory */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
48 # define DT_BLK 6 /* block device */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
49 # define DT_REG 8 /* regular file */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
50 # define DT_LNK 10 /* symbolic link */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
51 # define DT_SOCK 12 /* socket */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
52 # define DT_WHT 14 /* whiteout */ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
53 typedef struct gl_directory DIR; |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
54 # define GNULIB_defined_struct_dirent 1 |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
55 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
56 #endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
57 |
16715
be14d9f76493
Enable common subexpression optimization in GCC.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
58 /* The __attribute__ feature is available in gcc versions 2.5 and later. |
be14d9f76493
Enable common subexpression optimization in GCC.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
59 The attribute __pure__ was added in gcc 2.96. */ |
be14d9f76493
Enable common subexpression optimization in GCC.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
60 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) |
be14d9f76493
Enable common subexpression optimization in GCC.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
61 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
be14d9f76493
Enable common subexpression optimization in GCC.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
62 #else |
be14d9f76493
Enable common subexpression optimization in GCC.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
63 # define _GL_ATTRIBUTE_PURE /* empty */ |
be14d9f76493
Enable common subexpression optimization in GCC.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
64 #endif |
be14d9f76493
Enable common subexpression optimization in GCC.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
65 |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
66 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
67 |
12422
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
68 /* The definition of _GL_ARG_NONNULL is copied here. */ |
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
12421
diff
changeset
|
69 |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
70 /* The definition of _GL_WARN_ON_USE is copied here. */ |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
71 |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 |
10663
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
73 /* Declare overridden functions. */ |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
74 |
15610
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
75 #if @GNULIB_OPENDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
76 # if @REPLACE_OPENDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
77 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
78 # undef opendir |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
79 # define opendir rpl_opendir |
17937
34065aa26b62
glob, etc.: port to MSVC v18 on MS-Windows 8.1
Paul Eggert <eggert@cs.ucla.edu>
parents:
17848
diff
changeset
|
80 # define GNULIB_defined_opendir 1 |
15610
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
81 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
82 _GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1))); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
83 _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name)); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
84 # else |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
85 # if !@HAVE_OPENDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
86 _GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1))); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
87 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
88 _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name)); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
89 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
90 _GL_CXXALIASWARN (opendir); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
91 #elif defined GNULIB_POSIXCHECK |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
92 # undef opendir |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
93 # if HAVE_RAW_DECL_OPENDIR |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
94 _GL_WARN_ON_USE (opendir, "opendir is not portable - " |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
95 "use gnulib module opendir for portability"); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
96 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
97 #endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
98 |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
99 #if @GNULIB_READDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
100 # if !@HAVE_READDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
101 _GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1))); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
102 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
103 _GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp)); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
104 _GL_CXXALIASWARN (readdir); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
105 #elif defined GNULIB_POSIXCHECK |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
106 # undef readdir |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
107 # if HAVE_RAW_DECL_READDIR |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
108 _GL_WARN_ON_USE (readdir, "readdir is not portable - " |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
109 "use gnulib module readdir for portability"); |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
110 # endif |
15610
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
111 #endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
112 |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
113 #if @GNULIB_REWINDDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
114 # if !@HAVE_REWINDDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
115 _GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1))); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
116 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
117 _GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp)); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
118 _GL_CXXALIASWARN (rewinddir); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
119 #elif defined GNULIB_POSIXCHECK |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
120 # undef rewinddir |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
121 # if HAVE_RAW_DECL_REWINDDIR |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
122 _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - " |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
123 "use gnulib module rewinddir for portability"); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
124 # endif |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
125 #endif |
15610
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
126 |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
127 #if @GNULIB_CLOSEDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
128 # if @REPLACE_CLOSEDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
129 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
130 # undef closedir |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
131 # define closedir rpl_closedir |
17937
34065aa26b62
glob, etc.: port to MSVC v18 on MS-Windows 8.1
Paul Eggert <eggert@cs.ucla.edu>
parents:
17848
diff
changeset
|
132 # define GNULIB_defined_closedir 1 |
15610
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
133 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
134 _GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
135 _GL_CXXALIAS_RPL (closedir, int, (DIR *dirp)); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
136 # else |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
137 # if !@HAVE_CLOSEDIR@ |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
138 _GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
139 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
140 _GL_CXXALIAS_SYS (closedir, int, (DIR *dirp)); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
141 # endif |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
142 _GL_CXXALIASWARN (closedir); |
15610
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
143 #elif defined GNULIB_POSIXCHECK |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
144 # undef closedir |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
145 # if HAVE_RAW_DECL_CLOSEDIR |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
146 _GL_WARN_ON_USE (closedir, "closedir is not portable - " |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
147 "use gnulib module closedir for portability"); |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
148 # endif |
de2ecfd7fc4a
New modules 'opendir', 'readdir', 'rewinddir', 'closedir'.
Bruno Haible <bruno@clisp.org>
parents:
15603
diff
changeset
|
149 #endif |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
150 |
10663
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
151 #if @GNULIB_DIRFD@ |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
152 /* Return the file descriptor associated with the given directory stream, |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
153 or -1 if none exists. */ |
13508
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
154 # if @REPLACE_DIRFD@ |
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
155 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
156 # undef dirfd |
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
157 # define dirfd rpl_dirfd |
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
158 # endif |
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
159 _GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); |
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
160 _GL_CXXALIAS_RPL (dirfd, int, (DIR *)); |
18208
4de72064cdfe
opendir, closedir, dirfd, fdopendir: port to OS/2 kLIBC
KO Myung-Hun <komh78@gmail.com>
parents:
18189
diff
changeset
|
161 |
4de72064cdfe
opendir, closedir, dirfd, fdopendir: port to OS/2 kLIBC
KO Myung-Hun <komh78@gmail.com>
parents:
18189
diff
changeset
|
162 # ifdef __KLIBC__ |
4de72064cdfe
opendir, closedir, dirfd, fdopendir: port to OS/2 kLIBC
KO Myung-Hun <komh78@gmail.com>
parents:
18189
diff
changeset
|
163 /* Gnulib internal hooks needed to maintain the dirfd metadata. */ |
4de72064cdfe
opendir, closedir, dirfd, fdopendir: port to OS/2 kLIBC
KO Myung-Hun <komh78@gmail.com>
parents:
18189
diff
changeset
|
164 _GL_EXTERN_C int _gl_register_dirp_fd (int fd, DIR *dirp) |
4de72064cdfe
opendir, closedir, dirfd, fdopendir: port to OS/2 kLIBC
KO Myung-Hun <komh78@gmail.com>
parents:
18189
diff
changeset
|
165 _GL_ARG_NONNULL ((2)); |
4de72064cdfe
opendir, closedir, dirfd, fdopendir: port to OS/2 kLIBC
KO Myung-Hun <komh78@gmail.com>
parents:
18189
diff
changeset
|
166 _GL_EXTERN_C void _gl_unregister_dirp_fd (int fd); |
4de72064cdfe
opendir, closedir, dirfd, fdopendir: port to OS/2 kLIBC
KO Myung-Hun <komh78@gmail.com>
parents:
18189
diff
changeset
|
167 # endif |
13508
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
168 # else |
13627
d268b353aecf
dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX.
Bruno Haible <bruno@clisp.org>
parents:
13508
diff
changeset
|
169 # if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd |
d268b353aecf
dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX.
Bruno Haible <bruno@clisp.org>
parents:
13508
diff
changeset
|
170 /* dirfd is defined as a macro and not as a function. |
d268b353aecf
dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX.
Bruno Haible <bruno@clisp.org>
parents:
13508
diff
changeset
|
171 Turn it into a function and get rid of the macro. */ |
d268b353aecf
dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX.
Bruno Haible <bruno@clisp.org>
parents:
13508
diff
changeset
|
172 static inline int (dirfd) (DIR *dp) { return dirfd (dp); } |
d268b353aecf
dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX.
Bruno Haible <bruno@clisp.org>
parents:
13508
diff
changeset
|
173 # undef dirfd |
d268b353aecf
dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX.
Bruno Haible <bruno@clisp.org>
parents:
13508
diff
changeset
|
174 # endif |
13508
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
175 # if !(@HAVE_DECL_DIRFD@ || defined dirfd) |
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
176 _GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); |
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
177 # endif |
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
178 _GL_CXXALIAS_SYS (dirfd, int, (DIR *)); |
10663
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
179 # endif |
13508
abc6ebd285a3
dirfd: Avoid link error on AIX 7.1.
Bruno Haible <bruno@clisp.org>
parents:
13095
diff
changeset
|
180 _GL_CXXALIASWARN (dirfd); |
10663
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
181 #elif defined GNULIB_POSIXCHECK |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
182 # undef dirfd |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
183 # if HAVE_RAW_DECL_DIRFD |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
184 _GL_WARN_ON_USE (dirfd, "dirfd is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
185 "use gnulib module dirfd for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
186 # endif |
10663
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
187 #endif |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
188 |
11934
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
189 #if @GNULIB_FDOPENDIR@ |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
190 /* Open a directory stream visiting the given directory file |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
191 descriptor. Return NULL and set errno if fd is not visiting a |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
192 directory. On success, this function consumes fd (it will be |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
193 implicitly closed either by this function or by a subsequent |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
194 closedir). */ |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
195 # if @REPLACE_FDOPENDIR@ |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
196 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
197 # undef fdopendir |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
198 # define fdopendir rpl_fdopendir |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
199 # endif |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
200 _GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd)); |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
201 _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd)); |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
202 # else |
13095
c47c56095752
fdopendir: work around FreeBSD bug
Eric Blake <eblake@redhat.com>
parents:
13094
diff
changeset
|
203 # if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
204 _GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd)); |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
205 # endif |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
206 _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd)); |
11934
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
207 # endif |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
208 _GL_CXXALIASWARN (fdopendir); |
11934
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
209 #elif defined GNULIB_POSIXCHECK |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
210 # undef fdopendir |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
211 # if HAVE_RAW_DECL_FDOPENDIR |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
212 _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
213 "use gnulib module fdopendir for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
214 # endif |
11934
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
215 #endif |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
216 |
11038 | 217 #if @GNULIB_SCANDIR@ |
218 /* Scan the directory DIR, calling FILTER on each directory entry. | |
219 Entries for which FILTER returns nonzero are individually malloc'd, | |
220 sorted using qsort with CMP, and collected in a malloc'd array in | |
221 *NAMELIST. Returns the number of entries selected, or -1 on error. */ | |
222 # if !@HAVE_SCANDIR@ | |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
223 _GL_FUNCDECL_SYS (scandir, int, |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
224 (const char *dir, struct dirent ***namelist, |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
225 int (*filter) (const struct dirent *), |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
226 int (*cmp) (const struct dirent **, const struct dirent **)) |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
227 _GL_ARG_NONNULL ((1, 2, 4))); |
11038 | 228 # endif |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
229 /* Need to cast, because on glibc systems, the fourth parameter is |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
230 int (*cmp) (const void *, const void *). */ |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
231 _GL_CXXALIAS_SYS_CAST (scandir, int, |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
232 (const char *dir, struct dirent ***namelist, |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
233 int (*filter) (const struct dirent *), |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
234 int (*cmp) (const struct dirent **, const struct dirent **))); |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
235 _GL_CXXALIASWARN (scandir); |
11038 | 236 #elif defined GNULIB_POSIXCHECK |
237 # undef scandir | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
238 # if HAVE_RAW_DECL_SCANDIR |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
239 _GL_WARN_ON_USE (scandir, "scandir is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
240 "use gnulib module scandir for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
241 # endif |
11038 | 242 #endif |
243 | |
11039 | 244 #if @GNULIB_ALPHASORT@ |
245 /* Compare two 'struct dirent' entries alphabetically. */ | |
246 # if !@HAVE_ALPHASORT@ | |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
247 _GL_FUNCDECL_SYS (alphasort, int, |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
248 (const struct dirent **, const struct dirent **) |
16715
be14d9f76493
Enable common subexpression optimization in GCC.
Bruno Haible <bruno@clisp.org>
parents:
16201
diff
changeset
|
249 _GL_ATTRIBUTE_PURE |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
250 _GL_ARG_NONNULL ((1, 2))); |
11039 | 251 # endif |
12930
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
252 /* Need to cast, because on glibc systems, the parameters are |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
253 (const void *, const void *). */ |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
254 _GL_CXXALIAS_SYS_CAST (alphasort, int, |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
255 (const struct dirent **, const struct dirent **)); |
8de7d7c428e7
dirent: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
256 _GL_CXXALIASWARN (alphasort); |
11039 | 257 #elif defined GNULIB_POSIXCHECK |
258 # undef alphasort | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
259 # if HAVE_RAW_DECL_ALPHASORT |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
260 _GL_WARN_ON_USE (alphasort, "alphasort is unportable - " |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
261 "use gnulib module alphasort for portability"); |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12601
diff
changeset
|
262 # endif |
11039 | 263 #endif |
264 | |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
265 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
266 #endif /* _@GUARD_PREFIX@_DIRENT_H */ |
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
267 #endif /* _@GUARD_PREFIX@_DIRENT_H */ |