version 1.16, 1999/10/04 21:26:10 |
version 1.17, 1999/12/04 22:42:32 |
|
|
*/ |
*/ |
#define TIME_CORRECT(p, ttype) \ |
#define TIME_CORRECT(p, ttype) \ |
if ((p)->type == ttype && (p)->flags == F_LESSTHAN) \ |
if ((p)->type == ttype && (p)->flags == F_LESSTHAN) \ |
++((p)->t_data); |
++((p)->sec_data); |
|
|
/* |
/* |
* -amin n functions -- |
* -amin n functions -- |
|
|
extern time_t now; |
extern time_t now; |
|
|
COMPARE((now - entry->fts_statp->st_atime + |
COMPARE((now - entry->fts_statp->st_atime + |
60 - 1) / 60, plan->t_data); |
60 - 1) / 60, plan->sec_data); |
} |
} |
|
|
PLAN * |
PLAN * |
|
|
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
|
|
new = palloc(N_AMIN, f_amin); |
new = palloc(N_AMIN, f_amin); |
new->t_data = find_parsenum(new, "-amin", arg, NULL); |
new->sec_data = find_parsenum(new, "-amin", arg, NULL); |
TIME_CORRECT(new, N_AMIN); |
TIME_CORRECT(new, N_AMIN); |
return (new); |
return (new); |
} |
} |
|
|
{ |
{ |
|
|
COMPARE((now - entry->fts_statp->st_atime + |
COMPARE((now - entry->fts_statp->st_atime + |
SECSPERDAY - 1) / SECSPERDAY, plan->t_data); |
SECSPERDAY - 1) / SECSPERDAY, plan->sec_data); |
} |
} |
|
|
PLAN * |
PLAN * |
|
|
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
|
|
new = palloc(N_ATIME, f_atime); |
new = palloc(N_ATIME, f_atime); |
new->t_data = find_parsenum(new, "-atime", arg, NULL); |
new->sec_data = find_parsenum(new, "-atime", arg, NULL); |
TIME_CORRECT(new, N_ATIME); |
TIME_CORRECT(new, N_ATIME); |
return (new); |
return (new); |
} |
} |
|
|
extern time_t now; |
extern time_t now; |
|
|
COMPARE((now - entry->fts_statp->st_ctime + |
COMPARE((now - entry->fts_statp->st_ctime + |
60 - 1) / 60, plan->t_data); |
60 - 1) / 60, plan->sec_data); |
} |
} |
|
|
PLAN * |
PLAN * |
|
|
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
|
|
new = palloc(N_CMIN, f_cmin); |
new = palloc(N_CMIN, f_cmin); |
new->t_data = find_parsenum(new, "-cmin", arg, NULL); |
new->sec_data = find_parsenum(new, "-cmin", arg, NULL); |
TIME_CORRECT(new, N_CMIN); |
TIME_CORRECT(new, N_CMIN); |
return (new); |
return (new); |
} |
} |
|
|
{ |
{ |
|
|
COMPARE((now - entry->fts_statp->st_ctime + |
COMPARE((now - entry->fts_statp->st_ctime + |
SECSPERDAY - 1) / SECSPERDAY, plan->t_data); |
SECSPERDAY - 1) / SECSPERDAY, plan->sec_data); |
} |
} |
|
|
PLAN * |
PLAN * |
|
|
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
|
|
new = palloc(N_CTIME, f_ctime); |
new = palloc(N_CTIME, f_ctime); |
new->t_data = find_parsenum(new, "-ctime", arg, NULL); |
new->sec_data = find_parsenum(new, "-ctime", arg, NULL); |
TIME_CORRECT(new, N_CTIME); |
TIME_CORRECT(new, N_CTIME); |
return (new); |
return (new); |
} |
} |
|
|
{ |
{ |
|
|
COMPARE((now - entry->fts_statp->st_mtime + SECSPERDAY - 1) / |
COMPARE((now - entry->fts_statp->st_mtime + SECSPERDAY - 1) / |
SECSPERDAY, plan->t_data); |
SECSPERDAY, plan->sec_data); |
} |
} |
|
|
PLAN * |
PLAN * |
|
|
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
|
|
new = palloc(N_MTIME, f_mtime); |
new = palloc(N_MTIME, f_mtime); |
new->t_data = find_parsenum(new, "-mtime", arg, NULL); |
new->sec_data = find_parsenum(new, "-mtime", arg, NULL); |
TIME_CORRECT(new, N_MTIME); |
TIME_CORRECT(new, N_MTIME); |
return (new); |
return (new); |
} |
} |
|
|
extern time_t now; |
extern time_t now; |
|
|
COMPARE((now - entry->fts_statp->st_mtime + 60 - 1) / |
COMPARE((now - entry->fts_statp->st_mtime + 60 - 1) / |
60, plan->t_data); |
60, plan->sec_data); |
} |
} |
|
|
PLAN * |
PLAN * |
|
|
ftsoptions &= ~FTS_NOSTAT; |
ftsoptions &= ~FTS_NOSTAT; |
|
|
new = palloc(N_MMIN, f_mmin); |
new = palloc(N_MMIN, f_mmin); |
new->t_data = find_parsenum(new, "-mmin", arg, NULL); |
new->sec_data = find_parsenum(new, "-mmin", arg, NULL); |
TIME_CORRECT(new, N_MMIN); |
TIME_CORRECT(new, N_MMIN); |
return (new); |
return (new); |
} |
} |
|
|
PLAN *plan; |
PLAN *plan; |
FTSENT *entry; |
FTSENT *entry; |
{ |
{ |
return (entry->fts_statp->st_mtime > plan->t_data); |
|
|
return (entry->fts_statp->st_mtimespec.tv_sec > plan->t_data.tv_sec || |
|
(entry->fts_statp->st_mtimespec.tv_sec == plan->t_data.tv_sec && |
|
entry->fts_statp->st_mtimespec.tv_nsec > plan->t_data.tv_nsec)); |
} |
} |
|
|
PLAN * |
PLAN * |
|
|
if (stat(filename, &sb)) |
if (stat(filename, &sb)) |
err(1, "%s", filename); |
err(1, "%s", filename); |
new = palloc(N_NEWER, f_newer); |
new = palloc(N_NEWER, f_newer); |
new->t_data = sb.st_mtime; |
memcpy(&new->t_data, &sb.st_mtimespec, sizeof(struct timespec)); |
return (new); |
return (new); |
} |
} |
|
|
/* |
/* |
|
* -anewer file functions -- |
|
* |
|
* True if the current file has been accessed more recently |
|
* then the access time of the file named by the pathname |
|
* file. |
|
*/ |
|
int |
|
f_anewer(plan, entry) |
|
PLAN *plan; |
|
FTSENT *entry; |
|
{ |
|
|
|
return (entry->fts_statp->st_atimespec.tv_sec > plan->t_data.tv_sec || |
|
(entry->fts_statp->st_atimespec.tv_sec == plan->t_data.tv_sec && |
|
entry->fts_statp->st_atimespec.tv_nsec > plan->t_data.tv_nsec)); |
|
} |
|
|
|
PLAN * |
|
c_anewer(filename) |
|
char *filename; |
|
{ |
|
PLAN *new; |
|
struct stat sb; |
|
|
|
ftsoptions &= ~FTS_NOSTAT; |
|
|
|
if (stat(filename, &sb)) |
|
err(1, "%s", filename); |
|
new = palloc(N_NEWER, f_newer); |
|
memcpy(&new->t_data, &sb.st_atimespec, sizeof(struct timespec)); |
|
return (new); |
|
} |
|
|
|
/* |
|
* -cnewer file functions -- |
|
* |
|
* True if the current file has been changed more recently |
|
* then the inode change time of the file named by the pathname |
|
* file. |
|
*/ |
|
int |
|
f_cnewer(plan, entry) |
|
PLAN *plan; |
|
FTSENT *entry; |
|
{ |
|
|
|
return (entry->fts_statp->st_ctimespec.tv_sec > plan->t_data.tv_sec || |
|
(entry->fts_statp->st_ctimespec.tv_sec == plan->t_data.tv_sec && |
|
entry->fts_statp->st_ctimespec.tv_nsec > plan->t_data.tv_nsec)); |
|
} |
|
|
|
PLAN * |
|
c_cnewer(filename) |
|
char *filename; |
|
{ |
|
PLAN *new; |
|
struct stat sb; |
|
|
|
ftsoptions &= ~FTS_NOSTAT; |
|
|
|
if (stat(filename, &sb)) |
|
err(1, "%s", filename); |
|
new = palloc(N_NEWER, f_newer); |
|
memcpy(&new->t_data, &sb.st_ctimespec, sizeof(struct timespec)); |
|
return (new); |
|
} |
|
|
|
/* |
* -nogroup functions -- |
* -nogroup functions -- |
* |
* |
* True if file belongs to a user ID for which the equivalent |
* True if file belongs to a user ID for which the equivalent |
|
|
{ |
{ |
PLAN *new; |
PLAN *new; |
|
|
if ((new = malloc(sizeof(PLAN)))) { |
if ((new = calloc(1, sizeof(PLAN)))) { |
new->type = t; |
new->type = t; |
new->eval = f; |
new->eval = f; |
new->flags = 0; |
|
new->next = NULL; |
|
return (new); |
return (new); |
} |
} |
err(1, NULL); |
err(1, NULL); |