|
|
1.1 ! root 1: /* ! 2: * K. P. Vo ! 3: * AT&T Bell Laboratories ! 4: * ! 5: * ftwalk(3) interface definitions ! 6: */ ! 7: ! 8: #ifndef FTW_DOT ! 9: ! 10: #ifndef VOID ! 11: #define VOID char ! 12: #endif ! 13: ! 14: /* ! 15: * ftwalk() argument flags ! 16: */ ! 17: ! 18: #define FTW_CHILDREN (1<<0) /* call user function on child dirs too */ ! 19: #define FTW_DELAY (1<<1) /* do child stat after parent preorder */ ! 20: #define FTW_DOT (1<<2) /* don't chdir(2) to subdirectories */ ! 21: #define FTW_MULTIPLE (1<<3) /* path arg is 0 terminated char** argv */ ! 22: #define FTW_PHYSICAL (1<<4) /* physical rather than logical walk */ ! 23: #define FTW_POST (1<<5) /* visit descendants before parent */ ! 24: #define FTW_TWICE (1<<6) /* visit parent before&after descendants*/ ! 25: ! 26: #define FTW_USER (1<<10) /* first user flag bit */ ! 27: ! 28: struct FTW /* user function arg */ ! 29: { ! 30: struct FTW* left; /* left child in cycle check tree */ ! 31: struct FTW* right; /* right child in cycle check tree */ ! 32: struct FTW* link; /* identical to this elt on search path */ ! 33: struct FTW* parent; /* parent in current search path */ ! 34: union ! 35: { ! 36: long number; /* local number */ ! 37: char* pointer;/* local pointer */ ! 38: } local; /* local user data */ ! 39: struct stat statb; /* stat buffer of this object */ ! 40: char* path; /* full pathname */ ! 41: short pathlen;/* strlen(path) */ ! 42: unsigned short info; /* FTW_* type bits */ ! 43: unsigned short status; /* user function entry/return status */ ! 44: short level; /* current tree depth */ ! 45: short namelen;/* strlen(name) */ ! 46: char name[sizeof(int)]; /* file base name */ ! 47: }; ! 48: ! 49: /* ! 50: * individual struct FTW size ! 51: */ ! 52: ! 53: #define FTWSIZE(f) ((f)->namelen+1+sizeof(struct FTW)-sizeof(int)) ! 54: ! 55: /* ! 56: * FTW.info type bits ! 57: */ ! 58: ! 59: #define FTW_NS (1<<0) /* stat failed - unknown */ ! 60: #define FTW_F (1<<1) /* file - not directory or symbolic link*/ ! 61: #define FTW_SL (1<<2) /* symbolic link */ ! 62: #define FTW_D (1<<3) /* directory - pre-order visit */ ! 63: ! 64: #define FTW_C (1<<4) /* causes cycle */ ! 65: #define FTW_NR (1<<5) /* cannot read */ ! 66: #define FTW_NX (1<<6) /* cannot search */ ! 67: #define FTW_P (1<<7) /* post-order visit */ ! 68: ! 69: #define FTW_DC (FTW_D|FTW_C) /* directory - would cause cycle */ ! 70: #define FTW_DNR (FTW_D|FTW_NR) /* directory - no read permission */ ! 71: #define FTW_DNX (FTW_D|FTW_NX) /* directory - no search permission */ ! 72: #define FTW_DP (FTW_D|FTW_P) /* directory - post-order visit */ ! 73: ! 74: /* ! 75: * FTW.status entry values ! 76: */ ! 77: ! 78: #define FTW_NAME (1<<0) /* use FTW.name rather than FTW.path */ ! 79: #define FTW_PATH (1<<1) /* use FTW.path rather than FTW.name */ ! 80: ! 81: /* ! 82: * FTW.status return values ! 83: */ ! 84: ! 85: #define FTW_AGAIN (1<<2) /* process entry again */ ! 86: #define FTW_FOLLOW (1<<3) /* follow FTW_SL symlink */ ! 87: #define FTW_NOPOST (1<<4) /* skip post order visit */ ! 88: #define FTW_SKIP (1<<5) /* skip FTW_D directory */ ! 89: #define FTW_STAT (1<<6) /* userf did stat */ ! 90: ! 91: #if __STDC__ || __cplusplus || c_plusplus ! 92: #if __cplusplus ! 93: extern "C" { ! 94: #endif ! 95: extern int ftwalk(const char* path, int (*userf)(struct FTW*), int flags, int (*comparf)(struct FTW*, struct FTW*)); ! 96: #if __cplusplus ! 97: } ! 98: #endif ! 99: #else ! 100: extern int ftwalk(); ! 101: #endif ! 102: ! 103: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.