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