[Midnightbsd-cvs] src: usr.bin/find: $MidnightBSD$ add -B option to find.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Sep 11 19:01:20 EDT 2007


Log Message:
-----------
$MidnightBSD$ 

add -B option to find.  Obtained from FreeBSD.

Modified Files:
--------------
    src/usr.bin/find:
        Makefile (r1.1.1.1 -> r1.2)
        extern.h (r1.1.1.1 -> r1.2)
        find.1 (r1.1.1.1 -> r1.2)
        find.c (r1.2 -> r1.3)
        find.h (r1.1.1.1 -> r1.2)
        function.c (r1.1.1.1 -> r1.2)
        getdate.y (r1.1.1.1 -> r1.2)
        ls.c (r1.1.1.1 -> r1.2)
        main.c (r1.1.1.1 -> r1.2)
        misc.c (r1.1.1.1 -> r1.2)
        operator.c (r1.1.1.1 -> r1.2)
        option.c (r1.1.1.1 -> r1.2)

-------------- next part --------------
Index: extern.h
===================================================================
RCS file: /home/cvs/src/usr.bin/find/extern.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/extern.h -Lusr.bin/find/extern.h -u -r1.1.1.1 -r1.2
--- usr.bin/find/extern.h
+++ usr.bin/find/extern.h
@@ -31,7 +31,8 @@
  * SUCH DAMAGE.
  *
  *	@(#)extern.h	8.3 (Berkeley) 4/16/94
- *	$FreeBSD: src/usr.bin/find/extern.h,v 1.22 2004/07/29 03:29:44 tjr Exp $
+ *	$FreeBSD: src/usr.bin/find/extern.h,v 1.23 2006/05/14 20:23:00 krion Exp $
+ *	$MidnightBSD$
  */
 
 #include <sys/cdefs.h>
@@ -49,6 +50,7 @@
 void	 printlong(char *, char *, struct stat *);
 int	 queryuser(char **);
 OPTION	*lookup_option(const char *);
+void	 finish_execplus(void);
 
 creat_f	c_Xmin;
 creat_f	c_Xtime;
Index: getdate.y
===================================================================
RCS file: /home/cvs/src/usr.bin/find/getdate.y,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/getdate.y -Lusr.bin/find/getdate.y -u -r1.1.1.1 -r1.2
--- usr.bin/find/getdate.y
+++ usr.bin/find/getdate.y
@@ -13,7 +13,8 @@
 /* SUPPRESS 288 on yyerrlab *//* Label unused */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/find/getdate.y,v 1.3 2003/06/14 13:00:21 markm Exp $");
+/* $FreeBSD: src/usr.bin/find/getdate.y,v 1.4 2005/08/25 13:44:02 roberto Exp $" */
+__MBSDID("$MidnightBSD$");
 
 #include <stdio.h>
 #include <ctype.h>
@@ -857,6 +858,7 @@
     time_t		tod;
     time_t nowtime;
 
+    bzero (&gmt, sizeof(struct tm));
     yyInput = p;
     if (now == NULL) {
 	struct tm *gmt_ptr;
Index: function.c
===================================================================
RCS file: /home/cvs/src/usr.bin/find/function.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/function.c -Lusr.bin/find/function.c -u -r1.1.1.1 -r1.2
--- usr.bin/find/function.c
+++ usr.bin/find/function.c
@@ -41,7 +41,8 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/find/function.c,v 1.53 2005/01/25 14:07:25 ssouhlal Exp $");
+/* $FreeBSD: src/usr.bin/find/function.c,v 1.58 2006/05/27 18:27:41 krion Exp $ */
+__MBSDID("$MidnightBSD$");
 
 #include <sys/param.h>
 #include <sys/ucred.h>
@@ -76,6 +77,8 @@
 
 extern char **environ;
 
+static PLAN *lastexecplus = NULL;
+
 #define	COMPARE(a, b) do {						\
 	switch (plan->flags & F_ELG_MASK) {				\
 	case F_EQUAL:							\
@@ -136,7 +139,7 @@
 	value = strtoq(str, &endchar, 10);
 	if (value == 0 && endchar == str)
 		errx(1, "%s: %s: illegal numeric value", option, vp);
-	if (endchar[0] && (endch == NULL || endchar[0] != *endch))
+	if (endchar[0] && endch == NULL)
 		errx(1, "%s: %s: illegal trailing character", option, vp);
 	if (endch)
 		*endch = endchar[0];
@@ -234,10 +237,10 @@
 } /* 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 +251,7 @@
  *
  *    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 +265,9 @@
 	} 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 +294,7 @@
  *
  *	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 +307,8 @@
 
 	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
@@ -704,6 +714,8 @@
 		new->e_psizemax = argmax;
 		new->e_pbsize = 0;
 		cnt += new->e_pnummax + 1;
+		new->e_next = lastexecplus;
+		lastexecplus = new;
 	}
 	if ((new->e_argv = malloc(cnt * sizeof(char *))) == NULL)
 		err(1, NULL);
@@ -747,6 +759,19 @@
 	return new;
 }
 
+/* Finish any pending -exec ... {} + functions. */
+void
+finish_execplus()
+{
+	PLAN *p;
+
+	p = lastexecplus;
+	while (p != NULL) {
+		(p->execute)(p, NULL);
+		p = p->e_next;
+	}
+}
+
 int
 f_flags(PLAN *plan, FTSENT *entry)
 {
@@ -818,7 +843,7 @@
 	static int first = 1;
 	struct statfs sb;
 	static int val_type, val_flags;
-	char *p, save[2];
+	char *p, save[2] = {0,0};
 
 	if ((plan->flags & F_MTMASK) == F_MTUNKNOWN)
 		return 0;
@@ -928,7 +953,7 @@
 int
 f_group(PLAN *plan, FTSENT *entry)
 {
-	return entry->fts_statp->st_gid == plan->g_data;
+	COMPARE(entry->fts_statp->st_gid, plan->g_data);
 }
 
 PLAN *
@@ -942,15 +967,19 @@
 	gname = nextarg(option, argvp);
 	ftsoptions &= ~FTS_NOSTAT;
 
+	new = palloc(option);
 	g = getgrnam(gname);
 	if (g == NULL) {
+		char* cp = gname;
+		if( gname[0] == '-' || gname[0] == '+' )
+			gname++;
 		gid = atoi(gname);
 		if (gid == 0 && gname[0] != '0')
 			errx(1, "%s: %s: no such group", option->name, gname);
+		gid = find_parsenum(new, option->name, cp, NULL);
 	} else
 		gid = g->gr_gid;
 
-	new = palloc(option);
 	new->g_data = gid;
 	return new;
 }
@@ -1065,6 +1094,8 @@
 		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;
 }
@@ -1336,7 +1367,8 @@
  *
  *	True if the file size in bytes, divided by an implementation defined
  *	value and rounded up to the next integer, is n.  If n is followed by
- *	a c, the size is in bytes.
+ *      one of c k M G T P, the size is in bytes, kilobytes,
+ *      megabytes, gigabytes, terabytes or petabytes respectively.
  */
 #define	FIND_SIZE	512
 static int divsize = 1;
@@ -1357,6 +1389,7 @@
 	char *size_str;
 	PLAN *new;
 	char endch;
+	off_t scale;
 
 	size_str = nextarg(option, argvp);
 	ftsoptions &= ~FTS_NOSTAT;
@@ -1364,8 +1397,38 @@
 	new = palloc(option);
 	endch = 'c';
 	new->o_data = find_parsenum(new, option->name, size_str, &endch);
-	if (endch == 'c')
+	if (endch != '\0') {
 		divsize = 0;
+
+		switch (endch) {
+		case 'c':                       /* characters */
+			scale = 0x1LL;
+			break;
+		case 'k':                       /* kilobytes 1<<10 */
+			scale = 0x400LL;
+			break;
+		case 'M':                       /* megabytes 1<<20 */
+			scale = 0x100000LL;
+			break;
+		case 'G':                       /* gigabytes 1<<30 */
+			scale = 0x40000000LL;
+			break;
+		case 'T':                       /* terabytes 1<<40 */
+			scale = 0x1000000000LL;
+			break;
+		case 'P':                       /* petabytes 1<<50 */
+			scale = 0x4000000000000LL;
+			break;
+		default:
+			errx(1, "%s: %s: illegal trailing character",
+				option->name, size_str);
+			break;
+		}
+		if (new->o_data > QUAD_MAX / scale)
+			errx(1, "%s: %s: value too large",
+				option->name, size_str);
+		new->o_data *= scale;
+	}
 	return new;
 }
 
@@ -1439,7 +1502,7 @@
 int
 f_user(PLAN *plan, FTSENT *entry)
 {
-	return entry->fts_statp->st_uid == plan->u_data;
+	COMPARE(entry->fts_statp->st_uid, plan->u_data);
 }
 
 PLAN *
@@ -1453,15 +1516,19 @@
 	username = nextarg(option, argvp);
 	ftsoptions &= ~FTS_NOSTAT;
 
+	new = palloc(option);
 	p = getpwnam(username);
 	if (p == NULL) {
+		char* cp = username;
+		if( username[0] == '-' || username[0] == '+' )
+			username++;
 		uid = atoi(username);
 		if (uid == 0 && username[0] != '0')
 			errx(1, "%s: %s: no such user", option->name, username);
+		uid = find_parsenum(new, option->name, cp, NULL);
 	} else
 		uid = p->pw_uid;
 
-	new = palloc(option);
 	new->u_data = uid;
 	return new;
 }
Index: misc.c
===================================================================
RCS file: /home/cvs/src/usr.bin/find/misc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/misc.c -Lusr.bin/find/misc.c -u -r1.1.1.1 -r1.2
--- usr.bin/find/misc.c
+++ usr.bin/find/misc.c
@@ -42,7 +42,8 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/find/misc.c,v 1.8 2005/04/02 07:44:12 tjr Exp $");
+/* $FreeBSD: src/usr.bin/find/misc.c,v 1.8 2005/04/02 07:44:12 tjr Exp $" */
+__MBSDID("$MidnightBSD$");
 
 #include <sys/types.h>
 #include <sys/stat.h>
Index: main.c
===================================================================
RCS file: /home/cvs/src/usr.bin/find/main.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/main.c -Lusr.bin/find/main.c -u -r1.1.1.1 -r1.2
--- usr.bin/find/main.c
+++ usr.bin/find/main.c
@@ -47,7 +47,8 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/find/main.c,v 1.15 2003/06/14 13:00:21 markm Exp $");
+/* $FreeBSD: src/usr.bin/find/main.c,v 1.15 2003/06/14 13:00:21 markm Exp $ */
+__MBSDID("$MidnightBSD$");
 
 #include <sys/types.h>
 #include <sys/stat.h>
Index: find.1
===================================================================
RCS file: /home/cvs/src/usr.bin/find/find.1,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/find.1 -Lusr.bin/find/find.1 -u -r1.1.1.1 -r1.2
--- usr.bin/find/find.1
+++ usr.bin/find/find.1
@@ -33,9 +33,10 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)find.1	8.7 (Berkeley) 5/9/95
-.\" $FreeBSD: src/usr.bin/find/find.1,v 1.73 2005/06/14 11:50:51 ru Exp $
+.\" $FreeBSD: src/usr.bin/find/find.1,v 1.82 2007/02/28 10:19:25 ru Exp $
+.\" $MidnightBSD$
 .\"
-.Dd April 2, 2005
+.Dd September 11, 2007
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -46,6 +47,12 @@
 .Op Fl H | Fl L | Fl P
 .Op Fl EXdsx
 .Op Fl f Ar pathname
+.Ar pathname ...
+.Ar expression
+.Nm
+.Op Fl H | Fl L | Fl P
+.Op Fl EXdsx
+.Fl f Ar pathname
 .Op Ar pathname ...
 .Ar expression
 .Sh DESCRIPTION
@@ -69,7 +76,7 @@
 .Ic -regex
 and
 .Ic -iregex
-options as extended (modern) regular expressions rather than basic
+primaries as extended (modern) regular expressions rather than basic
 regular expressions (BRE's).
 The
 .Xr re_format 7
@@ -138,7 +145,9 @@
 .Ic -depth
 primary of
 .St -p1003.1-2001 .
+The
 .Fl d
+option
 can be useful when
 .Nm
 is used with
@@ -174,8 +183,37 @@
 .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 a file's inode creation
+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
+May be used in conjunction with other primaries to locate
 files with extended ACLs.
 See
 .Xr acl 3
@@ -430,7 +468,7 @@
 .Dq Li -> .
 The format is identical to that produced by
 .Bk -words
-.Nm ls Fl dgils .
+.Dq Nm ls Fl dgils .
 .Ek
 .It Ic -maxdepth Ar n
 Always true; descend at most
@@ -440,7 +478,7 @@
 .Ic -maxdepth
 primary is specified, it applies to the entire expression even if it would
 not normally be evaluated.
-.Ic -maxdepth Li 0
+.Dq Ic -maxdepth Li 0
 limits the whole search to the command line arguments.
 .It Ic -mindepth Ar n
 Always true; do not apply any tests or actions at levels less than
@@ -449,7 +487,7 @@
 .Ic -mindepth
 primary is specified, it applies to the entire expression even if it would
 not normally be evaluated.
-.Ic -mindepth Li 1
+.Dq Ic -mindepth Li 1
 processes all but the command line arguments.
 .It Ic -mmin Ar n
 True if the difference between the file last modification time and the time
@@ -496,17 +534,21 @@
 .Ar file .
 .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 ) ,
+.Pq Ar X Ns = Ns Cm a ,
+inode creation time
+.Pq Ar X Ns = Ns Cm B ,
 change time
-.Ar ( X Ns = Ns Cm c ) ,
+.Pq Ar X Ns = Ns Cm c ,
 or modification time
-.Ar ( X Ns = Ns Cm m )
+.Pq Ar X Ns = Ns Cm m
 than the last access time
-.Ar ( Y Ns = Ns Cm a ) ,
+.Pq Ar Y Ns = Ns Cm a ,
+inode creation time
+.Pq Ar Y Ns = Ns Cm B ,
 change time
-.Ar ( Y Ns = Ns Cm c ) ,
+.Pq Ar Y Ns = Ns Cm c ,
 or modification time
-.Ar ( Y Ns = Ns Cm m )
+.Pq Ar Y Ns = Ns Cm m
 of
 .Ar file .
 In addition, if
@@ -622,7 +664,8 @@
 .It Ic -print0
 This primary always evaluates to true.
 It prints the pathname of the current file to standard output, followed by an
-.Tn ASCII NUL
+.Tn ASCII
+.Dv NUL
 character (character code 0).
 .It Ic -prune
 This primary always evaluates to true.
@@ -648,7 +691,7 @@
 .Dq Li xyzzy
 or
 .Dq Li /foo/ .
-.It Ic -size Ar n Ns Op Cm c
+.It Ic -size Ar n Ns Op Cm ckMGTP
 True if the file's size, rounded up, in 512-byte blocks is
 .Ar n .
 If
@@ -659,6 +702,24 @@
 file's size is
 .Ar n
 bytes (characters).
+Similarly if
+.Ar n
+is followed by a scale indicator then the file's size is compared to
+.Ar n
+scaled as:
+.Pp
+.Bl -tag -width indent -compact
+.It Cm k
+kilobytes (1024 bytes)
+.It Cm M
+megabytes (1024 kilobytes)
+.It Cm G
+gigabytes (1024 megabytes)
+.It Cm T
+terabytes (1024 gigabytes)
+.It Cm P
+petabytes (1024 terabytes)
+.El
 .It Ic -type Ar t
 True if the file is of the specified type.
 Possible file types are as follows:
@@ -704,7 +765,7 @@
 The primaries may be combined using the following operators.
 The operators are listed in order of decreasing precedence.
 .Pp
-.Bl -tag -width "( expression )" -compact
+.Bl -tag -width indent -compact
 .It Cm \&( Ar expression Cm \&)
 This evaluates to true if the parenthesized expression evaluates to
 true.
@@ -828,14 +889,16 @@
 standard.
 .Pp
 All the single character options except
-.Ic -H
-and
-.Ic -L
-as well as the
-.Ic -iname , -inum , -iregex , -print0 , -delete , -ls ,
+.Fl H
 and
-.Ic -regex
-primaries are extensions to
+.Fl L
+as well as
+.Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype ,
+.Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin ,
+.Ic -path , -print0 , -regex
+and all of the
+.Ic -B*
+birthtime related primaries are extensions to
 .St -p1003.1-2001 .
 .Pp
 Historically, the
Index: operator.c
===================================================================
RCS file: /home/cvs/src/usr.bin/find/operator.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/operator.c -Lusr.bin/find/operator.c -u -r1.1.1.1 -r1.2
--- usr.bin/find/operator.c
+++ usr.bin/find/operator.c
@@ -41,7 +41,8 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/find/operator.c,v 1.14 2003/06/14 13:00:21 markm Exp $");
+/* $FreeBSD: src/usr.bin/find/operator.c,v 1.14 2003/06/14 13:00:21 markm Exp $ */
+__MBSDID("$MidnightBSD$");
 
 #include <sys/types.h>
 
Index: ls.c
===================================================================
RCS file: /home/cvs/src/usr.bin/find/ls.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/ls.c -Lusr.bin/find/ls.c -u -r1.1.1.1 -r1.2
--- usr.bin/find/ls.c
+++ usr.bin/find/ls.c
@@ -38,7 +38,8 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/find/ls.c,v 1.17 2004/01/20 09:27:03 des Exp $");
+/* $FreeBSD: src/usr.bin/find/ls.c,v 1.17 2004/01/20 09:27:03 des Exp $ */
+__MBSDID("$MidnightBSD$");
 
 #include <sys/param.h>
 #include <sys/stat.h>
Index: find.c
===================================================================
RCS file: /home/cvs/src/usr.bin/find/find.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lusr.bin/find/find.c -Lusr.bin/find/find.c -u -r1.2 -r1.3
--- usr.bin/find/find.c
+++ usr.bin/find/find.c
@@ -42,7 +42,8 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/find/find.c,v 1.17 2004/05/28 17:17:15 eik Exp $");
+/* $FreeBSD: src/usr.bin/find/find.c,v 1.18 2006/05/14 20:23:00 krion Exp $" */
+__MBSDID("$MidnightBSD$");
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -183,7 +184,7 @@
 
 	tree = fts_open(paths, ftsoptions, (issort ? find_compare : NULL));
 	if (tree == NULL)
-		err(1, "fts_open");
+		err(1, "ftsopen");
 
 	for (rval = 0; (entry = fts_read(tree)) != NULL;) {
 		if (maxdepth != -1 && entry->fts_level >= maxdepth) {
@@ -231,10 +232,7 @@
 		 */
 		for (p = plan; p && (p->execute)(p, entry); p = p->next);
 	}
-	/* Finish any pending -exec ... {} + functions. */
-	for (p = plan; p != NULL; p = p->next)
-		if (p->execute == f_exec && p->flags & F_EXECPLUS)
-			(p->execute)(p, NULL);
+	finish_execplus();
 	if (errno)
 		err(1, "fts_read");
 	return (rval);
Index: option.c
===================================================================
RCS file: /home/cvs/src/usr.bin/find/option.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/option.c -Lusr.bin/find/option.c -u -r1.1.1.1 -r1.2
--- usr.bin/find/option.c
+++ usr.bin/find/option.c
@@ -41,7 +41,8 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/find/option.c,v 1.23 2004/07/29 03:29:44 tjr Exp $");
+/* $FreeBSD: src/usr.bin/find/option.c,v 1.25 2006/04/05 23:06:11 ceri Exp $ */
+__MBSDID("$MidnightBSD$");
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -62,6 +63,9 @@
 	{ "!",		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 +98,22 @@
 	{ "-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 },
Index: Makefile
===================================================================
RCS file: /home/cvs/src/usr.bin/find/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/Makefile -Lusr.bin/find/Makefile -u -r1.1.1.1 -r1.2
--- usr.bin/find/Makefile
+++ usr.bin/find/Makefile
@@ -1,5 +1,6 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 # $FreeBSD: src/usr.bin/find/Makefile,v 1.18 2005/01/25 14:07:25 ssouhlal Exp $
+# $MidnightBSD$
 
 PROG=	find
 SRCS=	find.c function.c ls.c main.c misc.c operator.c option.c \
Index: find.h
===================================================================
RCS file: /home/cvs/src/usr.bin/find/find.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -Lusr.bin/find/find.h -Lusr.bin/find/find.h -u -r1.1.1.1 -r1.2
--- usr.bin/find/find.h
+++ usr.bin/find/find.h
@@ -34,7 +34,8 @@
  * SUCH DAMAGE.
  *
  *	@(#)find.h	8.1 (Berkeley) 6/6/93
- *	$FreeBSD: src/usr.bin/find/find.h,v 1.17 2004/05/28 17:17:15 eik Exp $
+ *	$FreeBSD: src/usr.bin/find/find.h,v 1.19 2006/05/14 20:23:01 krion Exp $
+ *	$MidnightBSD$
  */
 
 #include <regex.h>
@@ -72,6 +73,8 @@
 #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 {
@@ -103,6 +106,7 @@
 			int _e_psize;		/* number of bytes of args. */
 			int _e_pbsize;		/* base num. of bytes of args */
 			int _e_psizemax;	/* max num. of bytes of args */
+			struct _plandata *_e_next;/* next F_EXECPLUS in tree */
 		} ex;
 		char *_a_data[2];		/* array of char pointers */
 		char *_c_data;			/* char pointer */
@@ -133,6 +137,7 @@
 #define e_psize p_un.ex._e_psize
 #define e_pbsize p_un.ex._e_pbsize
 #define e_psizemax p_un.ex._e_psizemax
+#define e_next p_un.ex._e_next
 
 typedef struct _option {
 	const char *name;		/* option name */


More information about the Midnightbsd-cvs mailing list