| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef _@GUARD_PREFIX@_DIRENT_H |
| 18 |
|
| 19 |
#if __GNUC__ >= 3 |
| 20 |
@PRAGMA_SYSTEM_HEADER@ |
| 21 |
#endif |
| 22 |
@PRAGMA_COLUMNS@ |
| 23 |
|
| 24 |
|
| 25 |
#if @HAVE_DIRENT_H@ |
| 26 |
# @INCLUDE_NEXT@ @NEXT_DIRENT_H@ |
| 27 |
#endif |
| 28 |
|
| 29 |
#ifndef _@GUARD_PREFIX@_DIRENT_H |
| 30 |
#define _@GUARD_PREFIX@_DIRENT_H |
| 31 |
|
| 32 |
|
| 33 |
#include <sys/types.h> |
| 34 |
|
| 35 |
#if !@HAVE_DIRENT_H@ |
| 36 |
|
| 37 |
# if !GNULIB_defined_struct_dirent |
| 38 |
struct dirent |
| 39 |
{ |
| 40 |
char d_type; |
| 41 |
char d_name[1]; |
| 42 |
}; |
| 43 |
|
| 44 |
# define DT_UNKNOWN 0 |
| 45 |
# define DT_FIFO 1 |
| 46 |
# define DT_CHR 2 |
| 47 |
# define DT_DIR 4 |
| 48 |
# define DT_BLK 6 |
| 49 |
# define DT_REG 8 |
| 50 |
# define DT_LNK 10 |
| 51 |
# define DT_SOCK 12 |
| 52 |
# define DT_WHT 14 |
| 53 |
typedef struct gl_directory DIR; |
| 54 |
# define GNULIB_defined_struct_dirent 1 |
| 55 |
# endif |
| 56 |
#endif |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) |
| 61 |
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
| 62 |
#else |
| 63 |
# define _GL_ATTRIBUTE_PURE |
| 64 |
#endif |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
#if @GNULIB_OPENDIR@ |
| 76 |
# if @REPLACE_OPENDIR@ |
| 77 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 78 |
# undef opendir |
| 79 |
# define opendir rpl_opendir |
| 80 |
# define GNULIB_defined_opendir 1 |
| 81 |
# endif |
| 82 |
_GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1))); |
| 83 |
_GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name)); |
| 84 |
# else |
| 85 |
# if !@HAVE_OPENDIR@ |
| 86 |
_GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1))); |
| 87 |
# endif |
| 88 |
_GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name)); |
| 89 |
# endif |
| 90 |
_GL_CXXALIASWARN (opendir); |
| 91 |
#elif defined GNULIB_POSIXCHECK |
| 92 |
# undef opendir |
| 93 |
# if HAVE_RAW_DECL_OPENDIR |
| 94 |
_GL_WARN_ON_USE (opendir, "opendir is not portable - " |
| 95 |
"use gnulib module opendir for portability"); |
| 96 |
# endif |
| 97 |
#endif |
| 98 |
|
| 99 |
#if @GNULIB_READDIR@ |
| 100 |
# if !@HAVE_READDIR@ |
| 101 |
_GL_FUNCDECL_SYS (readdir, struct dirent *, (DIR *dirp) _GL_ARG_NONNULL ((1))); |
| 102 |
# endif |
| 103 |
_GL_CXXALIAS_SYS (readdir, struct dirent *, (DIR *dirp)); |
| 104 |
_GL_CXXALIASWARN (readdir); |
| 105 |
#elif defined GNULIB_POSIXCHECK |
| 106 |
# undef readdir |
| 107 |
# if HAVE_RAW_DECL_READDIR |
| 108 |
_GL_WARN_ON_USE (readdir, "readdir is not portable - " |
| 109 |
"use gnulib module readdir for portability"); |
| 110 |
# endif |
| 111 |
#endif |
| 112 |
|
| 113 |
#if @GNULIB_REWINDDIR@ |
| 114 |
# if !@HAVE_REWINDDIR@ |
| 115 |
_GL_FUNCDECL_SYS (rewinddir, void, (DIR *dirp) _GL_ARG_NONNULL ((1))); |
| 116 |
# endif |
| 117 |
_GL_CXXALIAS_SYS (rewinddir, void, (DIR *dirp)); |
| 118 |
_GL_CXXALIASWARN (rewinddir); |
| 119 |
#elif defined GNULIB_POSIXCHECK |
| 120 |
# undef rewinddir |
| 121 |
# if HAVE_RAW_DECL_REWINDDIR |
| 122 |
_GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - " |
| 123 |
"use gnulib module rewinddir for portability"); |
| 124 |
# endif |
| 125 |
#endif |
| 126 |
|
| 127 |
#if @GNULIB_CLOSEDIR@ |
| 128 |
# if @REPLACE_CLOSEDIR@ |
| 129 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 130 |
# undef closedir |
| 131 |
# define closedir rpl_closedir |
| 132 |
# define GNULIB_defined_closedir 1 |
| 133 |
# endif |
| 134 |
_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); |
| 135 |
_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp)); |
| 136 |
# else |
| 137 |
# if !@HAVE_CLOSEDIR@ |
| 138 |
_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); |
| 139 |
# endif |
| 140 |
_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp)); |
| 141 |
# endif |
| 142 |
_GL_CXXALIASWARN (closedir); |
| 143 |
#elif defined GNULIB_POSIXCHECK |
| 144 |
# undef closedir |
| 145 |
# if HAVE_RAW_DECL_CLOSEDIR |
| 146 |
_GL_WARN_ON_USE (closedir, "closedir is not portable - " |
| 147 |
"use gnulib module closedir for portability"); |
| 148 |
# endif |
| 149 |
#endif |
| 150 |
|
| 151 |
#if @GNULIB_DIRFD@ |
| 152 |
|
| 153 |
|
| 154 |
# if @REPLACE_DIRFD@ |
| 155 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 156 |
# undef dirfd |
| 157 |
# define dirfd rpl_dirfd |
| 158 |
# endif |
| 159 |
_GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); |
| 160 |
_GL_CXXALIAS_RPL (dirfd, int, (DIR *)); |
| 161 |
|
| 162 |
# ifdef __KLIBC__ |
| 163 |
|
| 164 |
_GL_EXTERN_C int _gl_register_dirp_fd (int fd, DIR *dirp) |
| 165 |
_GL_ARG_NONNULL ((2)); |
| 166 |
_GL_EXTERN_C void _gl_unregister_dirp_fd (int fd); |
| 167 |
# endif |
| 168 |
# else |
| 169 |
# if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd |
| 170 |
|
| 171 |
|
| 172 |
static inline int (dirfd) (DIR *dp) { return dirfd (dp); } |
| 173 |
# undef dirfd |
| 174 |
# endif |
| 175 |
# if !(@HAVE_DECL_DIRFD@ || defined dirfd) |
| 176 |
_GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); |
| 177 |
# endif |
| 178 |
_GL_CXXALIAS_SYS (dirfd, int, (DIR *)); |
| 179 |
# endif |
| 180 |
_GL_CXXALIASWARN (dirfd); |
| 181 |
#elif defined GNULIB_POSIXCHECK |
| 182 |
# undef dirfd |
| 183 |
# if HAVE_RAW_DECL_DIRFD |
| 184 |
_GL_WARN_ON_USE (dirfd, "dirfd is unportable - " |
| 185 |
"use gnulib module dirfd for portability"); |
| 186 |
# endif |
| 187 |
#endif |
| 188 |
|
| 189 |
#if @GNULIB_FDOPENDIR@ |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
# if @REPLACE_FDOPENDIR@ |
| 196 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 197 |
# undef fdopendir |
| 198 |
# define fdopendir rpl_fdopendir |
| 199 |
# endif |
| 200 |
_GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd)); |
| 201 |
_GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd)); |
| 202 |
# else |
| 203 |
# if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ |
| 204 |
_GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd)); |
| 205 |
# endif |
| 206 |
_GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd)); |
| 207 |
# endif |
| 208 |
_GL_CXXALIASWARN (fdopendir); |
| 209 |
#elif defined GNULIB_POSIXCHECK |
| 210 |
# undef fdopendir |
| 211 |
# if HAVE_RAW_DECL_FDOPENDIR |
| 212 |
_GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - " |
| 213 |
"use gnulib module fdopendir for portability"); |
| 214 |
# endif |
| 215 |
#endif |
| 216 |
|
| 217 |
#if @GNULIB_SCANDIR@ |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
# if !@HAVE_SCANDIR@ |
| 223 |
_GL_FUNCDECL_SYS (scandir, int, |
| 224 |
(const char *dir, struct dirent ***namelist, |
| 225 |
int (*filter) (const struct dirent *), |
| 226 |
int (*cmp) (const struct dirent **, const struct dirent **)) |
| 227 |
_GL_ARG_NONNULL ((1, 2, 4))); |
| 228 |
# endif |
| 229 |
|
| 230 |
|
| 231 |
_GL_CXXALIAS_SYS_CAST (scandir, int, |
| 232 |
(const char *dir, struct dirent ***namelist, |
| 233 |
int (*filter) (const struct dirent *), |
| 234 |
int (*cmp) (const struct dirent **, const struct dirent **))); |
| 235 |
_GL_CXXALIASWARN (scandir); |
| 236 |
#elif defined GNULIB_POSIXCHECK |
| 237 |
# undef scandir |
| 238 |
# if HAVE_RAW_DECL_SCANDIR |
| 239 |
_GL_WARN_ON_USE (scandir, "scandir is unportable - " |
| 240 |
"use gnulib module scandir for portability"); |
| 241 |
# endif |
| 242 |
#endif |
| 243 |
|
| 244 |
#if @GNULIB_ALPHASORT@ |
| 245 |
|
| 246 |
# if !@HAVE_ALPHASORT@ |
| 247 |
_GL_FUNCDECL_SYS (alphasort, int, |
| 248 |
(const struct dirent **, const struct dirent **) |
| 249 |
_GL_ATTRIBUTE_PURE |
| 250 |
_GL_ARG_NONNULL ((1, 2))); |
| 251 |
# endif |
| 252 |
|
| 253 |
|
| 254 |
_GL_CXXALIAS_SYS_CAST (alphasort, int, |
| 255 |
(const struct dirent **, const struct dirent **)); |
| 256 |
_GL_CXXALIASWARN (alphasort); |
| 257 |
#elif defined GNULIB_POSIXCHECK |
| 258 |
# undef alphasort |
| 259 |
# if HAVE_RAW_DECL_ALPHASORT |
| 260 |
_GL_WARN_ON_USE (alphasort, "alphasort is unportable - " |
| 261 |
"use gnulib module alphasort for portability"); |
| 262 |
# endif |
| 263 |
#endif |
| 264 |
|
| 265 |
|
| 266 |
#endif |
| 267 |
#endif |