function.c (8a0a76b862df8763ff2b90c633ccb90e4ece6032) function.c (31d534254ec82016c2bfe15ac3a0608f3ca45505)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Cimarron D. Taylor of the University of California, Berkeley.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 220 unchanged lines hidden (view full) ---

229
230 if ((arg = **argvp) == 0)
231 errx(1, "%s: requires additional arguments", option->name);
232 (*argvp)++;
233 return arg;
234} /* nextarg() */
235
236/*
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Cimarron D. Taylor of the University of California, Berkeley.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 220 unchanged lines hidden (view full) ---

229
230 if ((arg = **argvp) == 0)
231 errx(1, "%s: requires additional arguments", option->name);
232 (*argvp)++;
233 return arg;
234} /* nextarg() */
235
236/*
237 * The value of n for the inode times (atime, ctime, and mtime) is a range,
238 * i.e. n matches from (n - 1) to n 24 hour periods. This interacts with
239 * -n, such that "-mtime -1" would be less than 0 days, which isn't what the
240 * user wanted. Correct so that -1 is "less than 1".
237 * The value of n for the inode times (atime, birthtime, ctime, mtime) is a
238 * range, i.e. n matches from (n - 1) to n 24 hour periods. This interacts
239 * with -n, such that "-mtime -1" would be less than 0 days, which isn't what
240 * the user wanted. Correct so that -1 is "less than 1".
241 */
242#define TIME_CORRECT(p) \
243 if (((p)->flags & F_ELG_MASK) == F_LESSTHAN) \
244 ++((p)->t_data);
245
246/*
247 * -[acm]min n functions --
248 *
249 * True if the difference between the
250 * file access time (-amin)
241 */
242#define TIME_CORRECT(p) \
243 if (((p)->flags & F_ELG_MASK) == F_LESSTHAN) \
244 ++((p)->t_data);
245
246/*
247 * -[acm]min n functions --
248 *
249 * True if the difference between the
250 * file access time (-amin)
251 * file birth time (-Bmin)
251 * last change of file status information (-cmin)
252 * file modification time (-mmin)
253 * and the current time is n min periods.
254 */
255int
256f_Xmin(PLAN *plan, FTSENT *entry)
257{
258 if (plan->flags & F_TIME_C) {
259 COMPARE((now - entry->fts_statp->st_ctime +
260 60 - 1) / 60, plan->t_data);
261 } else if (plan->flags & F_TIME_A) {
262 COMPARE((now - entry->fts_statp->st_atime +
263 60 - 1) / 60, plan->t_data);
252 * last change of file status information (-cmin)
253 * file modification time (-mmin)
254 * and the current time is n min periods.
255 */
256int
257f_Xmin(PLAN *plan, FTSENT *entry)
258{
259 if (plan->flags & F_TIME_C) {
260 COMPARE((now - entry->fts_statp->st_ctime +
261 60 - 1) / 60, plan->t_data);
262 } else if (plan->flags & F_TIME_A) {
263 COMPARE((now - entry->fts_statp->st_atime +
264 60 - 1) / 60, plan->t_data);
265 } else if (plan->flags & F_TIME_B) {
266 COMPARE((now - entry->fts_statp->st_birthtime +
267 60 - 1) / 60, plan->t_data);
264 } else {
265 COMPARE((now - entry->fts_statp->st_mtime +
266 60 - 1) / 60, plan->t_data);
267 }
268}
269
270PLAN *
271c_Xmin(OPTION *option, char ***argvp)

--- 10 unchanged lines hidden (view full) ---

282 return new;
283}
284
285/*
286 * -[acm]time n functions --
287 *
288 * True if the difference between the
289 * file access time (-atime)
268 } else {
269 COMPARE((now - entry->fts_statp->st_mtime +
270 60 - 1) / 60, plan->t_data);
271 }
272}
273
274PLAN *
275c_Xmin(OPTION *option, char ***argvp)

--- 10 unchanged lines hidden (view full) ---

286 return new;
287}
288
289/*
290 * -[acm]time n functions --
291 *
292 * True if the difference between the
293 * file access time (-atime)
294 * file birth time (-Btime)
290 * last change of file status information (-ctime)
291 * file modification time (-mtime)
292 * and the current time is n 24 hour periods.
293 */
294
295int
296f_Xtime(PLAN *plan, FTSENT *entry)
297{
298 time_t xtime;
299
300 if (plan->flags & F_TIME_A)
301 xtime = entry->fts_statp->st_atime;
295 * last change of file status information (-ctime)
296 * file modification time (-mtime)
297 * and the current time is n 24 hour periods.
298 */
299
300int
301f_Xtime(PLAN *plan, FTSENT *entry)
302{
303 time_t xtime;
304
305 if (plan->flags & F_TIME_A)
306 xtime = entry->fts_statp->st_atime;
307 else if (plan->flags & F_TIME_B)
308 xtime = entry->fts_statp->st_birthtime;
302 else if (plan->flags & F_TIME_C)
303 xtime = entry->fts_statp->st_ctime;
304 else
305 xtime = entry->fts_statp->st_mtime;
306
307 if (plan->flags & F_EXACTTIME)
308 COMPARE(now - xtime, plan->t_data);
309 else

--- 750 unchanged lines hidden (view full) ---

1060 */
1061int
1062f_newer(PLAN *plan, FTSENT *entry)
1063{
1064 if (plan->flags & F_TIME_C)
1065 return entry->fts_statp->st_ctime > plan->t_data;
1066 else if (plan->flags & F_TIME_A)
1067 return entry->fts_statp->st_atime > plan->t_data;
309 else if (plan->flags & F_TIME_C)
310 xtime = entry->fts_statp->st_ctime;
311 else
312 xtime = entry->fts_statp->st_mtime;
313
314 if (plan->flags & F_EXACTTIME)
315 COMPARE(now - xtime, plan->t_data);
316 else

--- 750 unchanged lines hidden (view full) ---

1067 */
1068int
1069f_newer(PLAN *plan, FTSENT *entry)
1070{
1071 if (plan->flags & F_TIME_C)
1072 return entry->fts_statp->st_ctime > plan->t_data;
1073 else if (plan->flags & F_TIME_A)
1074 return entry->fts_statp->st_atime > plan->t_data;
1075 else if (plan->flags & F_TIME_B)
1076 return entry->fts_statp->st_birthtime > plan->t_data;
1068 else
1069 return entry->fts_statp->st_mtime > plan->t_data;
1070}
1071
1072PLAN *
1073c_newer(OPTION *option, char ***argvp)
1074{
1075 char *fn_or_tspec;

--- 496 unchanged lines hidden ---
1077 else
1078 return entry->fts_statp->st_mtime > plan->t_data;
1079}
1080
1081PLAN *
1082c_newer(OPTION *option, char ***argvp)
1083{
1084 char *fn_or_tspec;

--- 496 unchanged lines hidden ---