Mercurial > hg > octave-nkf > gnulib-hg
diff lib/dirent.in.h @ 10663:2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 19 Oct 2008 12:47:52 +0200 |
parents | fb8bcb95d71a |
children | 6c37790abb93 |
line wrap: on
line diff
--- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -26,13 +26,15 @@ #ifndef _GL_DIRENT_H #define _GL_DIRENT_H +/* The definition of GL_LINK_WARNING is copied here. */ -/* Declare overridden functions. */ #ifdef __cplusplus extern "C" { #endif +/* Declare overridden functions. */ + #if @REPLACE_FCHDIR@ # define opendir rpl_opendir extern DIR * opendir (const char *); @@ -40,6 +42,22 @@ extern int closedir (DIR *); #endif +/* Declare GNU extensions. */ + +#if @GNULIB_DIRFD@ +# if !@HAVE_DECL_DIRFD@ && !defined dirfd +/* Return the file descriptor associated with the given directory stream, + or -1 if none exists. */ +extern int dirfd (DIR const *dir); +# endif +#elif defined GNULIB_POSIXCHECK +# undef dirfd +# define dirfd(d) \ + (GL_LINK_WARNING ("dirfd is unportable - " \ + "use gnulib module dirfd for portability"), \ + dirfd (d)) +#endif + #ifdef __cplusplus } #endif