1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2/* A GNU-like <dirent.h>. 3 Copyright (C) 2006-2010 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/* The include_next requires a split double-inclusion guard. */ 25#include_next <dirent.h> 26 27#ifndef _GL_DIRENT_H 28#define _GL_DIRENT_H 29 30/* Get ino_t. Needed on some systems, including glibc 2.8. */ 31#include <sys/types.h> 32 33/* The definition of GL_LINK_WARNING is copied here. */ 34/* GL_LINK_WARNING("literal string") arranges to emit the literal string as 35 a linker warning on most glibc systems. 36 We use a linker warning rather than a preprocessor warning, because 37 #warning cannot be used inside macros. */ 38#ifndef GL_LINK_WARNING 39 /* This works on platforms with GNU ld and ELF object format. 40 Testing __GLIBC__ is sufficient for asserting that GNU ld is in use. 41 Testing __ELF__ guarantees the ELF object format. 42 Testing __GNUC__ is necessary for the compound expression syntax. */ 43# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__ 44# define GL_LINK_WARNING(message) \ 45 GL_LINK_WARNING1 (__FILE__, __LINE__, message) 46# define GL_LINK_WARNING1(file, line, message) \ 47 GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */ 48# define GL_LINK_WARNING2(file, line, message) \ 49 GL_LINK_WARNING3 (file ":" #line ": warning: " message) 50# define GL_LINK_WARNING3(message) \ 51 ({ static const char warning[sizeof (message)] \ 52 __attribute__ ((__unused__, \ 53 __section__ (".gnu.warning"), \ 54 __aligned__ (1))) \ 55 = message "\n"; \ 56 (void)0; \ 57 }) 58# else 59# define GL_LINK_WARNING(message) ((void) 0) 60# endif 61#endif 62 63/* The definition of _GL_ARG_NONNULL is copied here. */ 64/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 65 that the values passed as arguments n, ..., m must be non-NULL pointers. 66 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 67#ifndef _GL_ARG_NONNULL 68# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 69# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 70# else 71# define _GL_ARG_NONNULL(params) 72# endif 73#endif 74 75 76#ifdef __cplusplus 77extern "C" { 78#endif 79 80/* Declare overridden functions. */ 81 82#if 0 83# define closedir rpl_closedir 84extern int closedir (DIR *) _GL_ARG_NONNULL ((1)); 85#endif 86 87#if 1 88# if !1 && !defined dirfd 89/* Return the file descriptor associated with the given directory stream, 90 or -1 if none exists. */ 91extern int dirfd (DIR *dir) _GL_ARG_NONNULL ((1)); 92# endif 93#elif defined GNULIB_POSIXCHECK 94# undef dirfd 95# define dirfd(d) \ 96 (GL_LINK_WARNING ("dirfd is unportable - " \ 97 "use gnulib module dirfd for portability"), \ 98 dirfd (d)) 99#endif 100 101#if 1 102# if 0 103# undef fdopendir 104# define fdopendir rpl_fdopendir 105# endif 106# if !1 || 0 107/* Open a directory stream visiting the given directory file 108 descriptor. Return NULL and set errno if fd is not visiting a 109 directory. On success, this function consumes fd (it will be 110 implicitly closed either by this function or by a subsequent 111 closedir). */ 112extern DIR *fdopendir (int fd); 113# endif 114#elif defined GNULIB_POSIXCHECK 115# undef fdopendir 116# define fdopendir(f) \ 117 (GL_LINK_WARNING ("fdopendir is unportable - " \ 118 "use gnulib module fdopendir for portability"), \ 119 fdopendir (f)) 120#endif 121 122#if 0 123# define opendir rpl_opendir 124extern DIR * opendir (const char *) _GL_ARG_NONNULL ((1)); 125#endif 126 127#if 0 128/* Scan the directory DIR, calling FILTER on each directory entry. 129 Entries for which FILTER returns nonzero are individually malloc'd, 130 sorted using qsort with CMP, and collected in a malloc'd array in 131 *NAMELIST. Returns the number of entries selected, or -1 on error. */ 132# if !1 133extern int scandir (const char *dir, struct dirent ***namelist, 134 int (*filter) (const struct dirent *), 135 int (*cmp) (const struct dirent **, const struct dirent **)) 136 _GL_ARG_NONNULL ((1, 2, 4)); 137# endif 138#elif defined GNULIB_POSIXCHECK 139# undef scandir 140# define scandir(d,n,f,c) \ 141 (GL_LINK_WARNING ("scandir is unportable - " \ 142 "use gnulib module scandir for portability"), \ 143 scandir (d, n, f, c)) 144#endif 145 146#if 0 147/* Compare two 'struct dirent' entries alphabetically. */ 148# if !1 149extern int alphasort (const struct dirent **, const struct dirent **) 150 _GL_ARG_NONNULL ((1, 2)); 151# endif 152#elif defined GNULIB_POSIXCHECK 153# undef alphasort 154# define alphasort(a,b) \ 155 (GL_LINK_WARNING ("alphasort is unportable - " \ 156 "use gnulib module alphasort for portability"), \ 157 alphasort (a, b)) 158#endif 159 160#ifdef __cplusplus 161} 162#endif 163 164 165#endif /* _GL_DIRENT_H */ 166#endif /* _GL_DIRENT_H */ 167