Dr Andrew Scott G7VAV

My photo
 
April 2024
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12


ftw.h
001: /* Copyright (C) 1992,1996-1999,2003,2004 Free Software Foundation, Inc.
002:    This file is part of the GNU C Library.
003: 
004:    The GNU C Library is free software; you can redistribute it and/or
005:    modify it under the terms of the GNU Lesser General Public
006:    License as published by the Free Software Foundation; either
007:    version 2.1 of the License, or (at your option) any later version.
008: 
009:    The GNU C Library is distributed in the hope that it will be useful,
010:    but WITHOUT ANY WARRANTY; without even the implied warranty of
011:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:    Lesser General Public License for more details.
013: 
014:    You should have received a copy of the GNU Lesser General Public
015:    License along with the GNU C Library; if not, write to the Free
016:    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
017:    02111-1307 USA.  */
018: 
019: /*
020:  *      X/Open Portability Guide 4.2: ftw.h
021:  */
022: 
023: #ifndef _FTW_H
024: #define _FTW_H  1
025: 
026: #include <features.h>
027: 
028: #include <sys/types.h>
029: #include <sys/stat.h>
030: 
031: 
032: __BEGIN_DECLS
033: 
034: /* Values for the FLAG argument to the user function passed to `ftw'
035:    and 'nftw'.  */
036: enum
037: {
038:   FTW_F,                /* Regular file.  */
039: #define FTW_F    FTW_F
040:   FTW_D,                /* Directory.  */
041: #define FTW_D    FTW_D
042:   FTW_DNR,              /* Unreadable directory.  */
043: #define FTW_DNR  FTW_DNR
044:   FTW_NS,               /* Unstatable file.  */
045: #define FTW_NS   FTW_NS
046: 
047: #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
048: 
049:   FTW_SL,               /* Symbolic link.  */
050: # define FTW_SL  FTW_SL
051: #endif
052: 
053: #ifdef __USE_XOPEN_EXTENDED
054: /* These flags are only passed from the `nftw' function.  */
055:   FTW_DP,               /* Directory, all subdirs have been visited. */
056: # define FTW_DP  FTW_DP
057:   FTW_SLN               /* Symbolic link naming non-existing file.  */
058: # define FTW_SLN FTW_SLN
059: 
060: #endif  /* extended X/Open */
061: };
062: 
063: 
064: #ifdef __USE_XOPEN_EXTENDED
065: /* Flags for fourth argument of `nftw'.  */
066: enum
067: {
068:   FTW_PHYS = 1,         /* Perform physical walk, ignore symlinks.  */
069: # define FTW_PHYS       FTW_PHYS
070:   FTW_MOUNT = 2,        /* Report only files on same file system as the
071:                            argument.  */
072: # define FTW_MOUNT      FTW_MOUNT
073:   FTW_CHDIR = 4,        /* Change to current directory while processing it.  */
074: # define FTW_CHDIR      FTW_CHDIR
075:   FTW_DEPTH = 8         /* Report files in directory before directory itself.*/
076: # define FTW_DEPTH      FTW_DEPTH
077: # ifdef __USE_GNU
078:   ,
079:   FTW_ACTIONRETVAL = 16 /* Assume callback to return FTW_* values instead of
080:                            zero to continue and non-zero to terminate.  */
081: #  define FTW_ACTIONRETVAL FTW_ACTIONRETVAL
082: # endif
083: };
084: 
085: #ifdef __USE_GNU
086: /* Return values from callback functions.  */
087: enum
088: {
089:   FTW_CONTINUE = 0,     /* Continue with next sibling or for FTW_D with the
090:                            first child.  */
091: # define FTW_CONTINUE   FTW_CONTINUE
092:   FTW_STOP = 1,         /* Return from `ftw' or `nftw' with FTW_STOP as return
093:                            value.  */
094: # define FTW_STOP       FTW_STOP
095:   FTW_SKIP_SUBTREE = 2, /* Only meaningful for FTW_D: Don't walk through the
096:                            subtree, instead just continue with its next
097:                            sibling. */
098: # define FTW_SKIP_SUBTREE FTW_SKIP_SUBTREE
099:   FTW_SKIP_SIBLINGS = 3,/* Continue with FTW_DP callback for current directory
100:                             (if FTW_DEPTH) and then its siblings.  */
101: # define FTW_SKIP_SIBLINGS FTW_SKIP_SIBLINGS
102: };
103: #endif
104: 
105: /* Structure used for fourth argument to callback function for `nftw'.  */
106: struct FTW
107:   {
108:     int base;
109:     int level;
110:   };
111: #endif  /* extended X/Open */
112: 
113: 
114: /* Convenient types for callback functions.  */
115: typedef int (*__ftw_func_t) (__const char *__filename,
116:                              __const struct stat *__status, int __flag);
117: #ifdef __USE_LARGEFILE64
118: typedef int (*__ftw64_func_t) (__const char *__filename,
119:                                __const struct stat64 *__status, int __flag);
120: #endif
121: #ifdef __USE_XOPEN_EXTENDED
122: typedef int (*__nftw_func_t) (__const char *__filename,
123:                               __const struct stat *__status, int __flag,
124:                               struct FTW *__info);
125: # ifdef __USE_LARGEFILE64
126: typedef int (*__nftw64_func_t) (__const char *__filename,
127:                                 __const struct stat64 *__status,
128:                                 int __flag, struct FTW *__info);
129: # endif
130: #endif
131: 
132: /* Call a function on every element in a directory tree.
133: 
134:    This function is a possible cancellation point and therefore not
135:    marked with __THROW.  */
136: #ifndef __USE_FILE_OFFSET64
137: extern int ftw (__const char *__dir, __ftw_func_t __func, int __descriptors)
138:      __nonnull ((1, 2));
139: #else
140: # ifdef __REDIRECT
141: extern int __REDIRECT (ftw, (__const char *__dir, __ftw_func_t __func,
142:                              int __descriptors), ftw64) __nonnull ((1, 2));
143: # else
144: #  define ftw ftw64
145: # endif
146: #endif
147: #ifdef __USE_LARGEFILE64
148: extern int ftw64 (__const char *__dir, __ftw64_func_t __func,
149:                   int __descriptors) __nonnull ((1, 2));
150: #endif
151: 
152: #ifdef __USE_XOPEN_EXTENDED
153: /* Call a function on every element in a directory tree.  FLAG allows
154:    to specify the behaviour more detailed.
155: 
156:    This function is a possible cancellation point and therefore not
157:    marked with __THROW.  */
158: # ifndef __USE_FILE_OFFSET64
159: extern int nftw (__const char *__dir, __nftw_func_t __func, int __descriptors,
160:                  int __flag) __nonnull ((1, 2));
161: # else
162: #  ifdef __REDIRECT
163: extern int __REDIRECT (nftw, (__const char *__dir, __nftw_func_t __func,
164:                               int __descriptors, int __flag), nftw64)
165:      __nonnull ((1, 2));
166: #  else
167: #   define nftw nftw64
168: #  endif
169: # endif
170: # ifdef __USE_LARGEFILE64
171: extern int nftw64 (__const char *__dir, __nftw64_func_t __func,
172:                    int __descriptors, int __flag) __nonnull ((1, 2));
173: # endif
174: #endif
175: 
176: __END_DECLS
177: 
178: #endif  /* ftw.h */
179: 


for client 3.138.113.188
© Andrew Scott 2006 - 2024,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/