MFC the birthtime related primaries.
This commit is contained in:
parent
ea5b0e487d
commit
93ddf3c337
@ -35,7 +35,7 @@
|
||||
.\" @(#)find.1 8.7 (Berkeley) 5/9/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 2, 2005
|
||||
.Dd May 14, 2006
|
||||
.Dt FIND 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -174,6 +174,35 @@ primary.
|
||||
.El
|
||||
.Sh PRIMARIES
|
||||
.Bl -tag -width indent
|
||||
.It Ic -Bmin Ar n
|
||||
True if the difference between the time of a file's inode creation
|
||||
and the time
|
||||
.Nm
|
||||
was started, rounded up to the next full minute, is
|
||||
.Ar n
|
||||
minutes.
|
||||
.It Ic -Bnewer Ar file
|
||||
Same as
|
||||
.Ic -newerBm .
|
||||
.It Ic -Btime Ar n Ns Op Cm smhdw
|
||||
If no units are specified, this primary evaluates to
|
||||
true if the difference between the time of a file's inode creation
|
||||
and the time
|
||||
.Nm
|
||||
was started, rounded up to the next full 24-hour period, is
|
||||
.Ar n
|
||||
24-hour periods.
|
||||
.Pp
|
||||
If units are specified, this primary evaluates to
|
||||
true if the difference between the time of last change of file status
|
||||
information and the time
|
||||
.Nm
|
||||
was started is exactly
|
||||
.Ar n
|
||||
units.
|
||||
Please refer to the
|
||||
.Ic -atime
|
||||
primary description for information on supported time units.
|
||||
.It Ic -acl
|
||||
May be used in conjunction with other options to locate
|
||||
files with extended ACLs.
|
||||
@ -497,12 +526,16 @@ True if the current file has a more recent last modification time than
|
||||
.It Ic -newer Ns Ar X Ns Ar Y Ar file
|
||||
True if the current file has a more recent last access time
|
||||
.Ar ( X Ns = Ns Cm a ) ,
|
||||
inode creation time
|
||||
.Ar ( X Ns = Ns Cm B ) ,
|
||||
change time
|
||||
.Ar ( X Ns = Ns Cm c ) ,
|
||||
or modification time
|
||||
.Ar ( X Ns = Ns Cm m )
|
||||
than the last access time
|
||||
.Ar ( Y Ns = Ns Cm a ) ,
|
||||
inode creation time
|
||||
.Ar ( Y Ns = Ns Cm B ) ,
|
||||
change time
|
||||
.Ar ( Y Ns = Ns Cm c ) ,
|
||||
or modification time
|
||||
@ -832,10 +865,10 @@ All the single character options except
|
||||
and
|
||||
.Ic -L
|
||||
as well as the
|
||||
.Ic -iname , -inum , -iregex , -print0 , -delete , -ls ,
|
||||
and
|
||||
.Ic -regex
|
||||
primaries are extensions to
|
||||
.Ic -iname , -inum , -iregex , -print0 , -delete , -ls , -regex ,
|
||||
and all of the
|
||||
.Ic -B
|
||||
birthtime related primaries are extensions to
|
||||
.St -p1003.1-2001 .
|
||||
.Pp
|
||||
Historically, the
|
||||
|
@ -72,6 +72,8 @@ typedef struct _plandata *creat_f(struct _option *, char ***);
|
||||
#define F_IGNCASE 0x00010000 /* iname ipath iregex */
|
||||
#define F_EXACTTIME F_IGNCASE /* -[acm]time units syntax */
|
||||
#define F_EXECPLUS 0x00020000 /* -exec ... {} + */
|
||||
#define F_TIME_B 0x00040000 /* one of -Btime, -Bnewer, -newerB* */
|
||||
#define F_TIME2_B 0x00080000 /* one of -newer?B */
|
||||
|
||||
/* node definition */
|
||||
typedef struct _plandata {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -62,6 +62,9 @@ static OPTION const options[] = {
|
||||
{ "!", c_simple, f_not, 0 },
|
||||
{ "(", c_simple, f_openparen, 0 },
|
||||
{ ")", c_simple, f_closeparen, 0 },
|
||||
{ "-Bmin", c_Xmin, f_Xmin, F_TIME_B },
|
||||
{ "-Bnewer", c_newer, f_newer, F_TIME_B },
|
||||
{ "-Btime", c_Xtime, f_Xtime, F_TIME_B },
|
||||
{ "-a", c_and, NULL, 0 },
|
||||
{ "-acl", c_acl, f_acl, 0 },
|
||||
{ "-amin", c_Xmin, f_Xmin, F_TIME_A },
|
||||
@ -94,14 +97,22 @@ static OPTION const options[] = {
|
||||
{ "-mtime", c_Xtime, f_Xtime, 0 },
|
||||
{ "-name", c_name, f_name, 0 },
|
||||
{ "-newer", c_newer, f_newer, 0 },
|
||||
{ "-newerBB", c_newer, f_newer, F_TIME_B | F_TIME2_B },
|
||||
{ "-newerBa", c_newer, f_newer, F_TIME_B | F_TIME2_A },
|
||||
{ "-newerBc", c_newer, f_newer, F_TIME_B | F_TIME2_C },
|
||||
{ "-newerBm", c_newer, f_newer, F_TIME_B },
|
||||
{ "-newerBt", c_newer, f_newer, F_TIME_B | F_TIME2_T },
|
||||
{ "-neweraB", c_newer, f_newer, F_TIME_A | F_TIME2_B },
|
||||
{ "-neweraa", c_newer, f_newer, F_TIME_A | F_TIME2_A },
|
||||
{ "-newerac", c_newer, f_newer, F_TIME_A | F_TIME2_C },
|
||||
{ "-neweram", c_newer, f_newer, F_TIME_A },
|
||||
{ "-newerat", c_newer, f_newer, F_TIME_A | F_TIME2_T },
|
||||
{ "-newercB", c_newer, f_newer, F_TIME_C | F_TIME2_B },
|
||||
{ "-newerca", c_newer, f_newer, F_TIME_C | F_TIME2_A },
|
||||
{ "-newercc", c_newer, f_newer, F_TIME_C | F_TIME2_C },
|
||||
{ "-newercm", c_newer, f_newer, F_TIME_C },
|
||||
{ "-newerct", c_newer, f_newer, F_TIME_C | F_TIME2_T },
|
||||
{ "-newermB", c_newer, f_newer, F_TIME2_B },
|
||||
{ "-newerma", c_newer, f_newer, F_TIME2_A },
|
||||
{ "-newermc", c_newer, f_newer, F_TIME2_C },
|
||||
{ "-newermm", c_newer, f_newer, 0 },
|
||||
|
Loading…
Reference in New Issue
Block a user