]> arthur.barton.de Git - netatalk.git/blob - include/atalk/ftw.h
Use own ftw func in ad cp
[netatalk.git] / include / atalk / ftw.h
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., 59 Temple Place, Suite 330, Boston, MA
17    02111-1307 USA.  */
18
19 /*
20  *      X/Open Portability Guide 4.2: ftw.h
21  */
22
23 #ifndef _ATALK_FTW_H
24 #define _ATALK_FTW_H    1
25
26 #include <features.h>
27
28 #include <sys/types.h>
29 #include <sys/stat.h>
30
31
32 __BEGIN_DECLS
33
34 /* Values for the FLAG argument to the user function passed to `ftw'
35    and 'nftw'.  */
36 enum
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   FTW_SL,               /* Symbolic link.  */
47 # define FTW_SL  FTW_SL
48
49 /* These flags are only passed from the `nftw' function.  */
50   FTW_DP,               /* Directory, all subdirs have been visited. */
51 # define FTW_DP  FTW_DP
52   FTW_SLN               /* Symbolic link naming non-existing file.  */
53 # define FTW_SLN FTW_SLN
54 };
55
56
57 /* Flags for fourth argument of `nftw'.  */
58 enum
59 {
60   FTW_PHYS = 1,         /* Perform physical walk, ignore symlinks.  */
61 # define FTW_PHYS       FTW_PHYS
62   FTW_MOUNT = 2,        /* Report only files on same file system as the
63                            argument.  */
64 # define FTW_MOUNT      FTW_MOUNT
65   FTW_CHDIR = 4,        /* Change to current directory while processing it.  */
66 # define FTW_CHDIR      FTW_CHDIR
67   FTW_DEPTH = 8,        /* Report files in directory before directory itself.*/
68 # define FTW_DEPTH      FTW_DEPTH
69   FTW_ACTIONRETVAL = 16 /* Assume callback to return FTW_* values instead of
70                            zero to continue and non-zero to terminate.  */
71 #  define FTW_ACTIONRETVAL FTW_ACTIONRETVAL
72 };
73
74 /* Return values from callback functions.  */
75 enum
76 {
77   FTW_CONTINUE = 0,     /* Continue with next sibling or for FTW_D with the
78                            first child.  */
79 # define FTW_CONTINUE   FTW_CONTINUE
80   FTW_STOP = 1,         /* Return from `ftw' or `nftw' with FTW_STOP as return
81                            value.  */
82 # define FTW_STOP       FTW_STOP
83   FTW_SKIP_SUBTREE = 2, /* Only meaningful for FTW_D: Don't walk through the
84                            subtree, instead just continue with its next
85                            sibling. */
86 # define FTW_SKIP_SUBTREE FTW_SKIP_SUBTREE
87   FTW_SKIP_SIBLINGS = 3,/* Continue with FTW_DP callback for current directory
88                             (if FTW_DEPTH) and then its siblings.  */
89 # define FTW_SKIP_SIBLINGS FTW_SKIP_SIBLINGS
90 };
91
92 /* Structure used for fourth argument to callback function for `nftw'.  */
93 struct FTW
94   {
95     int base;
96     int level;
97   };
98
99 /* Convenient types for callback functions.  */
100 typedef int (*nftw_func_t) (const char *filename,
101                             const struct stat *status,
102                             int flag,
103                             struct FTW *info);
104 #define NFTW_FUNC_T nftw_func_t
105
106 typedef void (*dir_notification_func_t) (void);
107
108 extern int nftw(const char *dir,
109                 nftw_func_t func,
110                 dir_notification_func_t up,
111                 int descriptors,
112                 int flag);
113
114 __END_DECLS
115
116 #endif  /* ATALK_FTW_H */