1 1.1 agc /* $NetBSD: ftw.h,v 1.1 2005/12/30 23:07:33 agc Exp $ */ 2 1.1 agc 3 1.1 agc /* From OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp */ 4 1.1 agc 5 1.1 agc /* 6 1.1 agc * Copyright (c) 2003 Todd C. Miller <Todd.Miller (at) courtesan.com> 7 1.1 agc * 8 1.1 agc * Permission to use, copy, modify, and distribute this software for any 9 1.1 agc * purpose with or without fee is hereby granted, provided that the above 10 1.1 agc * copyright notice and this permission notice appear in all copies. 11 1.1 agc * 12 1.1 agc * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 1.1 agc * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 1.1 agc * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 1.1 agc * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 1.1 agc * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 1.1 agc * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 1.1 agc * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 1.1 agc * 20 1.1 agc * Sponsored in part by the Defense Advanced Research Projects 21 1.1 agc * Agency (DARPA) and Air Force Research Laboratory, Air Force 22 1.1 agc * Materiel Command, USAF, under agreement number F39502-99-1-0512. 23 1.1 agc */ 24 1.1 agc 25 1.1 agc #ifndef _FTW_H 26 1.1 agc #define _FTW_H 27 1.1 agc 28 1.1 agc #include <sys/types.h> 29 1.1 agc #include <sys/stat.h> 30 1.1 agc 31 1.1 agc /* 32 1.1 agc * Valid flags for the 3rd argument to the function that is passed as the 33 1.1 agc * second argument to ftw(3) and nftw(3). Say it three times fast! 34 1.1 agc */ 35 1.1 agc #define FTW_F 0 /* File. */ 36 1.1 agc #define FTW_D 1 /* Directory. */ 37 1.1 agc #define FTW_DNR 2 /* Directory without read permission. */ 38 1.1 agc #define FTW_DP 3 /* Directory with subdirectories visited. */ 39 1.1 agc #define FTW_NS 4 /* Unknown type; stat() failed. */ 40 1.1 agc #define FTW_SL 5 /* Symbolic link. */ 41 1.1 agc #define FTW_SLN 6 /* Sym link that names a nonexistent file. */ 42 1.1 agc 43 1.1 agc /* 44 1.1 agc * Flags for use as the 4th argument to nftw(3). These may be ORed together. 45 1.1 agc */ 46 1.1 agc #define FTW_PHYS 0x01 /* Physical walk, don't follow sym links. */ 47 1.1 agc #define FTW_MOUNT 0x02 /* The walk does not cross a mount point. */ 48 1.1 agc #define FTW_DEPTH 0x04 /* Subdirs visited before the dir itself. */ 49 1.1 agc #define FTW_CHDIR 0x08 /* Change to a directory before reading it. */ 50 1.1 agc 51 1.1 agc struct FTW { 52 1.1 agc int base; 53 1.1 agc int level; 54 1.1 agc }; 55 1.1 agc 56 1.1 agc __BEGIN_DECLS 57 1.1 agc int ftw(const char *, int (*)(const char *, const struct stat *, int), int); 58 1.1 agc int nftw(const char *, int (*)(const char *, const struct stat *, int, 59 1.1 agc struct FTW *), int, int); 60 1.1 agc __END_DECLS 61 1.1 agc 62 1.1 agc #endif /* !_FTW_H */ 63