netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
ftw.h
Go to the documentation of this file.
1/* Copyright (C) 1992,1996-1999,2003,2004 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
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 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301 USA. */
18
19/*
20 * X/Open Portability Guide 4.2: ftw.h
21 */
22
23#include <sys/stat.h>
24#include <sys/types.h>
25
26/* Values for the FLAG argument to the user function passed to `ftw'
27 and 'nftw'. */
28enum {
29 FTW_F, /* Regular file. */
30#define FTW_F FTW_F
31 FTW_D, /* Directory. */
32#define FTW_D FTW_D
33 FTW_DNR, /* Unreadable directory. */
34#define FTW_DNR FTW_DNR
35 FTW_NS, /* Unstatable file. */
36#define FTW_NS FTW_NS
37 FTW_SL, /* Symbolic link. */
38# define FTW_SL FTW_SL
39
40 /* These flags are only passed from the `nftw' function. */
41 FTW_DP, /* Directory, all subdirs have been visited. */
42# define FTW_DP FTW_DP
43 FTW_SLN /* Symbolic link naming non-existing file. */
44# define FTW_SLN FTW_SLN
45};
46
47
48/* Flags for fourth argument of `nftw'. */
49enum {
50 FTW_PHYS = 1, /* Perform physical walk, ignore symlinks. */
51# define FTW_PHYS FTW_PHYS
52 FTW_MOUNT = 2, /* Report only files on same file system as the
53 argument. */
54# define FTW_MOUNT FTW_MOUNT
55 FTW_CHDIR = 4, /* Change to current directory while processing it. */
56# define FTW_CHDIR FTW_CHDIR
57 FTW_DEPTH = 8, /* Report files in directory before directory itself.*/
58# define FTW_DEPTH FTW_DEPTH
59 FTW_ACTIONRETVAL = 16 /* Assume callback to return FTW_* values instead of
60 zero to continue and non-zero to terminate. */
61# define FTW_ACTIONRETVAL FTW_ACTIONRETVAL
62};
63
64/* Return values from callback functions. */
65enum {
66 FTW_CONTINUE = 0, /* Continue with next sibling or for FTW_D with the
67 first child. */
68# define FTW_CONTINUE FTW_CONTINUE
69 FTW_STOP = 1, /* Return from `ftw' or `nftw' with FTW_STOP as return
70 value. */
71# define FTW_STOP FTW_STOP
72 FTW_SKIP_SUBTREE = 2, /* Only meaningful for FTW_D: Don't walk through the
73 subtree, instead just continue with its next
74 sibling. */
75# define FTW_SKIP_SUBTREE FTW_SKIP_SUBTREE
76 FTW_SKIP_SIBLINGS = 3,/* Continue with FTW_DP callback for current directory
77 (if FTW_DEPTH) and then its siblings. */
78# define FTW_SKIP_SIBLINGS FTW_SKIP_SIBLINGS
79};
80
81/* Structure used for fourth argument to callback function for `nftw'. */
82struct FTW {
83 int base;
84 int level;
85};
86
87/* Convenient types for callback functions. */
88typedef int (*nftw_func_t)(const char *filename,
89 const struct stat *status,
90 int flag,
91 struct FTW *info);
92
93typedef void (*dir_notification_func_t)(void);
94
95extern int nftw(const char *dir,
96 nftw_func_t func,
98 int descriptors,
99 int flag);
#define FTW_NS
Definition ftw.h:36
#define FTW_F
Definition ftw.h:30
void(* dir_notification_func_t)(void)
Definition ftw.h:93
#define FTW_CONTINUE
Definition ftw.h:68
int(* nftw_func_t)(const char *filename, const struct stat *status, int flag, struct FTW *info)
Definition ftw.h:88
#define FTW_ACTIONRETVAL
#define FTW_MOUNT
Definition ftw.h:54
#define FTW_DP
Definition ftw.h:42
#define FTW_PHYS
Definition ftw.h:51
#define FTW_STOP
Definition ftw.h:71
#define FTW_SKIP_SUBTREE
Definition ftw.h:75
#define FTW_D
Definition ftw.h:32
int nftw(const char *dir, nftw_func_t func, dir_notification_func_t up, int descriptors, int flag)
#define FTW_CHDIR
Definition ftw.h:56
#define FTW_SL
Definition ftw.h:38
#define FTW_SKIP_SIBLINGS
Definition ftw.h:78
#define FTW_SLN
Definition ftw.h:44
#define FTW_DNR
Definition ftw.h:34
#define FTW_DEPTH
Definition ftw.h:58
#define flag(x)
Definition netacnv.c:15
static char * status
Definition pap.c:93
Definition ftw.h:82
int base
Definition ftw.h:83
int level
Definition ftw.h:84
Definition include/atalk/directory.h:62