Mercurial > hg > octave-nkf > gnulib-hg
annotate lib/dirent.in.h @ 12028:a65ac3b41872
openat: simplify use of at-func.c
* lib/at-func.c (includes): Include prerequisites here, to
simplify requirements on client files.
* lib/openat-priv.h: Add double-inclusion guard.
* lib/faccessat.c (includes): Simplify.
* lib/fchmodat.c (includes): Likewise.
* lib/fchownat.c (includes): Likewise.
* lib/mkdirat.c (includes): Likewise.
* lib/mkfifoat.c (includes): Likewise.
* lib/symlinkat.c (includes): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Sat, 19 Sep 2009 08:03:45 -0600 |
parents | a1e0b2efc812 |
children | bda9467a9d66 |
rev | line source |
---|---|
10659 | 1 /* A GNU-like <dirent.h>. |
11038 | 2 Copyright (C) 2006-2009 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 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9246
diff
changeset
|
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 #ifndef _GL_DIRENT_H |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
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 |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
22 |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 /* The include_next requires a split double-inclusion guard. */ |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 #@INCLUDE_NEXT@ @NEXT_DIRENT_H@ |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 #ifndef _GL_DIRENT_H |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 #define _GL_DIRENT_H |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 |
10663
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
29 /* The definition of GL_LINK_WARNING is copied here. */ |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 #ifdef __cplusplus |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 extern "C" { |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 #endif |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 |
10663
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
36 /* Declare overridden functions. */ |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
37 |
11992
a1e0b2efc812
fchdir: improve use of replacement functions
Eric Blake <ebb9@byu.net>
parents:
11934
diff
changeset
|
38 #if @REPLACE_CLOSEDIR@ |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 # define closedir rpl_closedir |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 extern int closedir (DIR *); |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 #endif |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 |
10663
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
43 #if @GNULIB_DIRFD@ |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
44 # if !@HAVE_DECL_DIRFD@ && !defined dirfd |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
45 /* 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
|
46 or -1 if none exists. */ |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
47 extern int dirfd (DIR const *dir); |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
48 # endif |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
49 #elif defined GNULIB_POSIXCHECK |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
50 # undef dirfd |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
51 # define dirfd(d) \ |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
52 (GL_LINK_WARNING ("dirfd is unportable - " \ |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
53 "use gnulib module dirfd for portability"), \ |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
54 dirfd (d)) |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
55 #endif |
2b0380d48ff6
Move the dirfd() declaration to <dirent.h>.
Bruno Haible <bruno@clisp.org>
parents:
10659
diff
changeset
|
56 |
11934
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
57 #if @GNULIB_FDOPENDIR@ |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
58 # if !@HAVE_FDOPENDIR@ |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
59 /* 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
|
60 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
|
61 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
|
62 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
|
63 closedir). */ |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
64 extern DIR *fdopendir (int fd); |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
65 # endif |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
66 #elif defined GNULIB_POSIXCHECK |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
67 # undef fdopendir |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
68 # define fdopendir(f) \ |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
69 (GL_LINK_WARNING ("fdopendir is unportable - " \ |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
70 "use gnulib module fdopendir for portability"), \ |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
71 fdopendir (f)) |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
72 #endif |
80567a8f98f8
fdopendir: split into its own module
Eric Blake <ebb9@byu.net>
parents:
11039
diff
changeset
|
73 |
11992
a1e0b2efc812
fchdir: improve use of replacement functions
Eric Blake <ebb9@byu.net>
parents:
11934
diff
changeset
|
74 #if @REPLACE_OPENDIR@ |
a1e0b2efc812
fchdir: improve use of replacement functions
Eric Blake <ebb9@byu.net>
parents:
11934
diff
changeset
|
75 # define opendir rpl_opendir |
a1e0b2efc812
fchdir: improve use of replacement functions
Eric Blake <ebb9@byu.net>
parents:
11934
diff
changeset
|
76 extern DIR * opendir (const char *); |
a1e0b2efc812
fchdir: improve use of replacement functions
Eric Blake <ebb9@byu.net>
parents:
11934
diff
changeset
|
77 #endif |
a1e0b2efc812
fchdir: improve use of replacement functions
Eric Blake <ebb9@byu.net>
parents:
11934
diff
changeset
|
78 |
11038 | 79 #if @GNULIB_SCANDIR@ |
80 /* Scan the directory DIR, calling FILTER on each directory entry. | |
81 Entries for which FILTER returns nonzero are individually malloc'd, | |
82 sorted using qsort with CMP, and collected in a malloc'd array in | |
83 *NAMELIST. Returns the number of entries selected, or -1 on error. */ | |
84 # if !@HAVE_SCANDIR@ | |
85 extern int scandir (const char *dir, struct dirent ***namelist, | |
86 int (*filter) (const struct dirent *), | |
87 int (*cmp) (const struct dirent **, const struct dirent **)); | |
88 # endif | |
89 #elif defined GNULIB_POSIXCHECK | |
90 # undef scandir | |
91 # define scandir(d,n,f,c) \ | |
92 (GL_LINK_WARNING ("scandir is unportable - " \ | |
93 "use gnulib module scandir for portability"), \ | |
94 scandir (d, n, f, c)) | |
95 #endif | |
96 | |
11039 | 97 #if @GNULIB_ALPHASORT@ |
98 /* Compare two 'struct dirent' entries alphabetically. */ | |
99 # if !@HAVE_ALPHASORT@ | |
100 extern int alphasort (const struct dirent **, const struct dirent **); | |
101 # endif | |
102 #elif defined GNULIB_POSIXCHECK | |
103 # undef alphasort | |
104 # define alphasort(a,b) \ | |
105 (GL_LINK_WARNING ("alphasort is unportable - " \ | |
106 "use gnulib module alphasort for portability"), \ | |
107 alphasort (a, b)) | |
108 #endif | |
109 | |
9246
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
110 #ifdef __cplusplus |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
111 } |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
112 #endif |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
113 |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
114 |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
115 #endif /* _GL_DIRENT_H */ |
eb22327879c5
Rename dirent_.h to dirent.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
116 #endif /* _GL_DIRENT_H */ |