]> sourceware.org Git - glibc.git/blame - io/ftw.h
Update.
[glibc.git] / io / ftw.h
CommitLineData
df4ef2ab 1/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
54d79e99 2 This file is part of the GNU C Library.
28f540f4 3
54d79e99
UD
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
28f540f4 8
54d79e99
UD
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
28f540f4 13
54d79e99
UD
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
28f540f4
RM
18
19/*
54d79e99 20 * X/Open Portability Guide 4.2: ftw.h
28f540f4
RM
21 */
22
23#ifndef _FTW_H
28f540f4 24#define _FTW_H 1
5107cf1d 25
28f540f4
RM
26#include <features.h>
27
76b87c03 28#include <sys/types.h>
5107cf1d 29#include <bits/stat.h>
28f540f4 30
28f540f4 31
1fb05e3d
UD
32__BEGIN_DECLS
33
76b87c03
UD
34/* Values for the FLAG argument to the user function passed to `ftw'
35 and 'nftw'. */
36enum
37{
38 FTW_F, /* Regular file. */
39#define FTW_F FTW_F
40 FTW_D, /* Directory. */
41#define FTW_D FTW_D
42 FTW_DNR, /* Unreadable directory. */
43#define FTW_DNR FTW_DNR
44 FTW_NS, /* Unstatable file. */
45#define FTW_NS FTW_NS
46
d951286f 47#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
76b87c03
UD
48
49 FTW_SL, /* Symbolic link. */
50# define FTW_SL FTW_SL
d951286f 51#endif
76b87c03 52
d951286f 53#ifdef __USE_XOPEN_EXTENDED
76b87c03
UD
54/* These flags are only passed from the `nftw' function. */
55 FTW_DP, /* Directory, all subdirs have been visited. */
56# define FTW_DP FTW_DP
57 FTW_SLN /* Symbolic link naming non-existing file. */
58# define FTW_SLN FTW_SLN
59
60#endif /* extended X/Open */
61};
62
63
64#ifdef __USE_XOPEN_EXTENDED
65/* Flags for fourth argument of `nftw'. */
66enum
67{
68 FTW_PHYS = 1, /* Perform physical walk, ignore symlinks. */
69# define FTW_PHYS FTW_PHYS
70 FTW_MOUNT = 2, /* Report only files on same file system as the
71 argument. */
72# define FTW_MOUNT FTW_MOUNT
73 FTW_CHDIR = 4, /* Change to current directory while processing it. */
74# define FTW_CHDIR FTW_CHDIR
75 FTW_DEPTH = 8 /* Report files in directory before directory itself.*/
76# define FTW_DEPTH FTW_DEPTH
77};
78
79/* Structure used for fourth argument to callback function for `nftw'. */
80struct FTW
81 {
82 int base;
83 int level;
84 };
85#endif /* extended X/Open */
86
87
88/* Convenient types for callback functions. */
2604afb1
UD
89typedef int (*__ftw_func_t) __P ((__const char *__filename,
90 __const struct stat *__status, int __flag));
1cab5444 91#if defined __USE_LARGEFILE64 || defined __USE_FILE_OFFSET64
dfd2257a
UD
92typedef int (*__ftw64_func_t) __P ((__const char *__filename,
93 __const struct stat64 *__status,
94 int __flag));
1cab5444 95#endif
76b87c03 96#ifdef __USE_XOPEN_EXTENDED
2604afb1
UD
97typedef int (*__nftw_func_t) __P ((__const char *__filename,
98 __const struct stat *__status, int __flag,
99 struct FTW *__info));
1cab5444 100# if defined __USE_LARGEFILE64 || defined __USE_FILE_OFFSET64
dfd2257a
UD
101typedef int (*__nftw64_func_t) __P ((__const char *__filename,
102 __const struct stat64 *__status,
103 int __flag, struct FTW *__info));
1cab5444 104# endif
76b87c03
UD
105#endif
106
28f540f4 107/* Call a function on every element in a directory tree. */
dfd2257a 108#ifndef __USE_FILE_OFFSET64
2604afb1
UD
109extern int ftw __P ((__const char *__dir, __ftw_func_t __func,
110 int __descriptors));
dfd2257a
UD
111#else
112extern int ftw __P ((__const char *__dir, __ftw64_func_t __func,
113 int __descriptors)) __asm__ ("ftw64");
114#endif
115#ifdef __USE_LARGEFILE64
116extern int ftw64 __P ((__const char *__dir, __ftw64_func_t __func,
117 int __descriptors));
118#endif
76b87c03
UD
119
120#ifdef __USE_XOPEN_EXTENDED
121/* Call a function on every element in a directory tree. FLAG allows
122 to specify the behaviour more detailed. */
dfd2257a 123# ifndef __USE_FILE_OFFSET64
2604afb1
UD
124extern int nftw __P ((__const char *__dir, __nftw_func_t __func,
125 int __descriptors, int __flag));
dfd2257a
UD
126# else
127extern int nftw __P ((__const char *__dir, __nftw64_func_t __func,
128 int __descriptors, int __flag)) __asm__ ("nftw64");
129# endif
130# ifdef __USE_LARGEFILE64
131extern int nftw64 __P ((__const char *__dir, __nftw64_func_t __func,
132 int __descriptors, int __flag));
133# endif
76b87c03 134#endif
28f540f4 135
1fb05e3d
UD
136__END_DECLS
137
28f540f4 138#endif /* ftw.h */
This page took 0.072546 seconds and 5 git commands to generate.