version 1.27, 2003/06/10 22:20:46 |
version 1.28, 2003/06/26 07:27:29 |
|
|
#include <unistd.h> |
#include <unistd.h> |
|
|
#include "find.h" |
#include "find.h" |
|
#include "extern.h" |
|
|
#define COMPARE(a, b) { \ |
#define COMPARE(a, b) { \ |
switch (plan->flags) { \ |
switch (plan->flags) { \ |
|
|
} |
} |
|
|
static PLAN *palloc(enum ntype, int (*)(PLAN *, FTSENT *)); |
static PLAN *palloc(enum ntype, int (*)(PLAN *, FTSENT *)); |
|
static long find_parsenum(PLAN *plan, char *option, char *vp, char *endch); |
|
static PLAN *palloc(enum ntype t, int (*f)(PLAN *, FTSENT *)); |
|
|
|
int f_amin(PLAN *, FTSENT *); |
|
int f_atime(PLAN *, FTSENT *); |
|
int f_cmin(PLAN *, FTSENT *); |
|
int f_ctime(PLAN *, FTSENT *); |
|
int f_always_true(PLAN *, FTSENT *); |
|
int f_empty(PLAN *, FTSENT *); |
|
int f_exec(PLAN *, FTSENT *); |
|
int f_execdir(PLAN *, FTSENT *); |
|
int f_flags(PLAN *, FTSENT *); |
|
int f_fstype(PLAN *, FTSENT *); |
|
int f_group(PLAN *, FTSENT *); |
|
int f_inum(PLAN *, FTSENT *); |
|
int f_empty(PLAN *, FTSENT *); |
|
int f_links(PLAN *, FTSENT *); |
|
int f_ls(PLAN *, FTSENT *); |
|
int f_maxdepth(PLAN *, FTSENT *); |
|
int f_mindepth(PLAN *, FTSENT *); |
|
int f_mtime(PLAN *, FTSENT *); |
|
int f_mmin(PLAN *, FTSENT *); |
|
int f_name(PLAN *, FTSENT *); |
|
int f_iname(PLAN *, FTSENT *); |
|
int f_newer(PLAN *, FTSENT *); |
|
int f_anewer(PLAN *, FTSENT *); |
|
int f_cnewer(PLAN *, FTSENT *); |
|
int f_nogroup(PLAN *, FTSENT *); |
|
int f_nouser(PLAN *, FTSENT *); |
|
int f_path(PLAN *, FTSENT *); |
|
int f_perm(PLAN *, FTSENT *); |
|
int f_print(PLAN *, FTSENT *); |
|
int f_print0(PLAN *, FTSENT *); |
|
int f_prune(PLAN *, FTSENT *); |
|
int f_size(PLAN *, FTSENT *); |
|
int f_type(PLAN *, FTSENT *); |
|
int f_user(PLAN *, FTSENT *); |
|
int f_expr(PLAN *, FTSENT *); |
|
int f_not(PLAN *, FTSENT *); |
|
int f_or(PLAN *, FTSENT *); |
|
|
extern int dotfd; |
extern int dotfd; |
extern time_t now; |
extern time_t now; |
extern FTS *tree; |
extern FTS *tree; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_amin(arg) |
c_amin(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_atime(arg) |
c_atime(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_cmin(arg) |
c_cmin(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_ctime(arg) |
c_ctime(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_depth(void) |
c_depth(char *ignore, char ***ignored, int unused) |
{ |
{ |
isdepth = 1; |
isdepth = 1; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_empty(void) |
c_empty(char *ignore, char ***ignored, int unused) |
{ |
{ |
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
|
|
|
|
* strings, but also flags meaning that the string has to be massaged. |
* strings, but also flags meaning that the string has to be massaged. |
*/ |
*/ |
PLAN * |
PLAN * |
c_exec(argvp, isok) |
c_exec(char *unused, char ***argvp, int isok) |
char ***argvp; |
|
int isok; |
|
{ |
{ |
PLAN *new; /* node returned */ |
PLAN *new; /* node returned */ |
int cnt; |
int cnt; |
|
|
* strings, but also flags meaning that the string has to be massaged. |
* strings, but also flags meaning that the string has to be massaged. |
*/ |
*/ |
PLAN * |
PLAN * |
c_execdir(argvp) |
c_execdir(char *ignored, char ***argvp, int unused) |
char ***argvp; |
|
{ |
{ |
PLAN *new; /* node returned */ |
PLAN *new; /* node returned */ |
int cnt; |
int cnt; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_flags(flags_str) |
c_flags(char *flags_str, char ***ignored, int unused) |
char *flags_str; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
u_int32_t flags, notflags; |
u_int32_t flags, notflags; |
|
|
* basis. |
* basis. |
*/ |
*/ |
PLAN * |
PLAN * |
c_follow(void) |
c_follow(char *ignore, char ***ignored, int unused) |
{ |
{ |
ftsoptions &= ~FTS_PHYSICAL; |
ftsoptions &= ~FTS_PHYSICAL; |
ftsoptions |= FTS_LOGICAL; |
ftsoptions |= FTS_LOGICAL; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_fstype(arg) |
c_fstype(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_group(gname) |
c_group(char *gname, char ***ignored, int unused) |
char *gname; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
struct group *g; |
struct group *g; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_inum(arg) |
c_inum(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_links(arg) |
c_links(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_ls(void) |
c_ls(char *ignore, char ***ignored, int unused) |
{ |
{ |
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
isoutput = 1; |
isoutput = 1; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_maxdepth(arg) |
c_maxdepth(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_mindepth(arg) |
c_mindepth(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_mtime(arg) |
c_mtime(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_mmin(arg) |
c_mmin(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_name(pattern) |
c_name(char *pattern, char ***ignored, int unused) |
char *pattern; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_iname(pattern) |
c_iname(char *pattern, char ***ignored, int unused) |
char *pattern; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_newer(filename) |
c_newer(char *filename, char ***ignored, int unused) |
char *filename; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
struct stat sb; |
struct stat sb; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_anewer(filename) |
c_anewer(char *filename, char ***ignored, int unused) |
char *filename; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
struct stat sb; |
struct stat sb; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_cnewer(filename) |
c_cnewer(char *filename, char ***ignored, int unused) |
char *filename; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
struct stat sb; |
struct stat sb; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_nogroup(void) |
c_nogroup(char *ignore, char ***ignored, int unused) |
{ |
{ |
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_nouser(void) |
c_nouser(char *ignore, char ***ignored, int unused) |
{ |
{ |
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_path(pattern) |
c_path(char *pattern, char ***ignored, int unused) |
char *pattern; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_perm(perm) |
c_perm(char *perm, char ***ignored, int unused) |
char *perm; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
mode_t *set; |
mode_t *set; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_print(void) |
c_print(char *ignore, char ***ignored, int unused) |
{ |
{ |
isoutput = 1; |
isoutput = 1; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_print0(void) |
c_print0(char *ignore, char ***ignored, int unused) |
{ |
{ |
isoutput = 1; |
isoutput = 1; |
|
|
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_prune(void) |
c_prune(char *ignore, char ***ignored, int unused) |
{ |
{ |
return (palloc(N_PRUNE, f_prune)); |
return (palloc(N_PRUNE, f_prune)); |
} |
} |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_size(arg) |
c_size(char *arg, char ***ignored, int unused) |
char *arg; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
char endch; |
char endch; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_type(typestring) |
c_type(char *typestring, char ***ignored, int unused) |
char *typestring; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
mode_t mask; |
mode_t mask; |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_user(username) |
c_user(char *username, char ***ignored, int unused) |
char *username; |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
struct passwd *p; |
struct passwd *p; |
|
|
* different device ID (st_dev, see stat() S5.6.2 [POSIX.1]) |
* different device ID (st_dev, see stat() S5.6.2 [POSIX.1]) |
*/ |
*/ |
PLAN * |
PLAN * |
c_xdev(void) |
c_xdev(char *ignore, char ***ignored, int unused) |
{ |
{ |
ftsoptions |= FTS_XDEV; |
ftsoptions |= FTS_XDEV; |
|
|
|
|
* to a N_EXPR node containing the expression and the ')' node is discarded. |
* to a N_EXPR node containing the expression and the ')' node is discarded. |
*/ |
*/ |
PLAN * |
PLAN * |
c_openparen(void) |
c_openparen(char *ignore, char ***ignored, int unused) |
{ |
{ |
return (palloc(N_OPENPAREN, (int (*)())-1)); |
return (palloc(N_OPENPAREN, (int (*)(PLAN *, FTSENT *))-1)); |
} |
} |
|
|
PLAN * |
PLAN * |
c_closeparen(void) |
c_closeparen(char *ignore, char ***ignored, int unused) |
{ |
{ |
return (palloc(N_CLOSEPAREN, (int (*)())-1)); |
return (palloc(N_CLOSEPAREN, (int (*)(PLAN *, FTSENT *))-1)); |
} |
} |
|
|
/* |
/* |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_not(void) |
c_not(char *ignore, char ***ignored, int unused) |
{ |
{ |
return (palloc(N_NOT, f_not)); |
return (palloc(N_NOT, f_not)); |
} |
} |
|
|
} |
} |
|
|
PLAN * |
PLAN * |
c_or(void) |
c_or(char *ignore, char ***ignored, int unused) |
{ |
{ |
return (palloc(N_OR, f_or)); |
return (palloc(N_OR, f_or)); |
} |
} |
|
|
static PLAN * |
static PLAN * |
palloc(t, f) |
palloc(enum ntype t, int (*f)(PLAN *, FTSENT *)) |
enum ntype t; |
|
int (*f)(PLAN *, FTSENT *); |
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|