aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/find/function.c
diff options
context:
space:
mode:
authorCeri Davies <ceri@FreeBSD.org>2006-04-03 20:36:37 +0000
committerCeri Davies <ceri@FreeBSD.org>2006-04-03 20:36:37 +0000
commit31d534254ec82016c2bfe15ac3a0608f3ca45505 (patch)
treee035182e79fc32d8cbc8a86417c289279b1e02da /usr.bin/find/function.c
parent95529bcb143872c45ba05bf334440c4559bc685d (diff)
downloadsrc-31d534254ec82016c2bfe15ac3a0608f3ca45505.tar.gz
src-31d534254ec82016c2bfe15ac3a0608f3ca45505.zip
Add -Btime, -Bnewer, -Bmin, -newerB[Bacmt], -newer[acmt]B options to
work with the st_birthtime field of struct stat. 'B' has been chosen to match the format specifier from stat(1). Approved by: jhb MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=157440
Diffstat (limited to 'usr.bin/find/function.c')
-rw-r--r--usr.bin/find/function.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 7052810c5b18..38bf813510d3 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -234,10 +234,10 @@ nextarg(OPTION *option, char ***argvp)
} /* nextarg() */
/*
- * The value of n for the inode times (atime, ctime, and mtime) is a range,
- * i.e. n matches from (n - 1) to n 24 hour periods. This interacts with
- * -n, such that "-mtime -1" would be less than 0 days, which isn't what the
- * user wanted. Correct so that -1 is "less than 1".
+ * The value of n for the inode times (atime, birthtime, ctime, mtime) is a
+ * range, i.e. n matches from (n - 1) to n 24 hour periods. This interacts
+ * with -n, such that "-mtime -1" would be less than 0 days, which isn't what
+ * the user wanted. Correct so that -1 is "less than 1".
*/
#define TIME_CORRECT(p) \
if (((p)->flags & F_ELG_MASK) == F_LESSTHAN) \
@@ -248,6 +248,7 @@ nextarg(OPTION *option, char ***argvp)
*
* True if the difference between the
* file access time (-amin)
+ * file birth time (-Bmin)
* last change of file status information (-cmin)
* file modification time (-mmin)
* and the current time is n min periods.
@@ -261,6 +262,9 @@ f_Xmin(PLAN *plan, FTSENT *entry)
} else if (plan->flags & F_TIME_A) {
COMPARE((now - entry->fts_statp->st_atime +
60 - 1) / 60, plan->t_data);
+ } else if (plan->flags & F_TIME_B) {
+ COMPARE((now - entry->fts_statp->st_birthtime +
+ 60 - 1) / 60, plan->t_data);
} else {
COMPARE((now - entry->fts_statp->st_mtime +
60 - 1) / 60, plan->t_data);
@@ -287,6 +291,7 @@ c_Xmin(OPTION *option, char ***argvp)
*
* True if the difference between the
* file access time (-atime)
+ * file birth time (-Btime)
* last change of file status information (-ctime)
* file modification time (-mtime)
* and the current time is n 24 hour periods.
@@ -299,6 +304,8 @@ f_Xtime(PLAN *plan, FTSENT *entry)
if (plan->flags & F_TIME_A)
xtime = entry->fts_statp->st_atime;
+ else if (plan->flags & F_TIME_B)
+ xtime = entry->fts_statp->st_birthtime;
else if (plan->flags & F_TIME_C)
xtime = entry->fts_statp->st_ctime;
else
@@ -1065,6 +1072,8 @@ f_newer(PLAN *plan, FTSENT *entry)
return entry->fts_statp->st_ctime > plan->t_data;
else if (plan->flags & F_TIME_A)
return entry->fts_statp->st_atime > plan->t_data;
+ else if (plan->flags & F_TIME_B)
+ return entry->fts_statp->st_birthtime > plan->t_data;
else
return entry->fts_statp->st_mtime > plan->t_data;
}