fs.h (1248B)
1 /* see LICENSE file for copyright and license details */ 2 #include <limits.h> 3 #include <sys/stat.h> 4 #include <sys/types.h> 5 6 struct history { 7 struct history *prev; 8 dev_t dev; 9 ino_t ino; 10 }; 11 12 struct recursor { 13 void (*fn)(int, const char *, struct stat *, void *, struct recursor *); 14 char path[PATH_MAX]; 15 size_t pathlen; 16 struct history *hist; 17 int depth; 18 int maxdepth; 19 int follow; 20 int flags; 21 int err; /* errno of the first failure */ 22 }; 23 24 enum { 25 SAMEDEV = 1 << 0, 26 DIRFIRST = 1 << 1, 27 SILENT = 1 << 2, 28 CONFIRM = 1 << 3, 29 IGNORE = 1 << 4, 30 /* for a library: nothing printed and nothing asked, failures are only 31 * counted and the first one kept in err */ 32 QUIET = 1 << 5, 33 }; 34 35 extern int cp_aflag; 36 extern int cp_fflag; 37 extern int cp_iflag; 38 extern int cp_pflag; 39 extern int cp_rflag; 40 extern int cp_vflag; 41 extern int cp_qflag; 42 extern int cp_follow; 43 extern int cp_status; 44 extern int cp_errno; 45 46 extern int rm_status; 47 48 extern int recurse_status; 49 50 void recurse(int, const char *, void *, struct recursor *); 51 52 int cp(const char *, const char *, int); 53 void rm(int, const char *, struct stat *st, void *, struct recursor *);