CVS commit: src/usr.bin/find

2021-03-18 Thread Aleksey Cheusov
Module Name:src
Committed By:   cheusov
Date:   Thu Mar 18 18:24:14 UTC 2021

Modified Files:
src/usr.bin/find: function.c

Log Message:
find: use POSIX strtoll(3) instead of legacy strtoq(3)


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.78 src/usr.bin/find/function.c:1.79
--- src/usr.bin/find/function.c:1.78	Thu Mar 18 18:21:18 2021
+++ src/usr.bin/find/function.c	Thu Mar 18 18:24:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.78 2021/03/18 18:21:18 cheusov Exp $	*/
+/*	$NetBSD: function.c,v 1.79 2021/03/18 18:24:14 cheusov Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)function.c	8.10 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: function.c,v 1.78 2021/03/18 18:21:18 cheusov Exp $");
+__RCSID("$NetBSD: function.c,v 1.79 2021/03/18 18:24:14 cheusov Exp $");
 #endif
 #endif /* not lint */
 
@@ -181,7 +181,7 @@ find_parsenum(PLAN *plan, const char *op
 	 * and endchar points to the beginning of the string we know we have
 	 * a syntax error.
 	 */
-	value = strtoq(str, , 10);
+	value = strtoll(str, , 10);
 	if (value == 0 && endchar == str)
 		errx(1, "%s: %s: illegal numeric value", option, vp);
 	if (endchar[0] && (endch == NULL || endchar[0] != *endch))



CVS commit: src/usr.bin/find

2021-03-18 Thread Aleksey Cheusov
Module Name:src
Committed By:   cheusov
Date:   Thu Mar 18 18:21:18 UTC 2021

Modified Files:
src/usr.bin/find: find.h function.c

Log Message:
find: use POSIX type uint32_t instead of u_int32_t


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/find/find.h
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.h
diff -u src/usr.bin/find/find.h:1.26 src/usr.bin/find/find.h:1.27
--- src/usr.bin/find/find.h:1.26	Mon Jun 13 00:04:40 2016
+++ src/usr.bin/find/find.h	Thu Mar 18 18:21:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: find.h,v 1.26 2016/06/13 00:04:40 pgoyette Exp $	*/
+/*	$NetBSD: find.h,v 1.27 2021/03/18 18:21:18 cheusov Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -65,7 +65,7 @@ typedef struct _plandata {
 	int flags;/* private flags */
 	enum ntype type;			/* plan node type */
 	union {
-		u_int32_t _f_data;		/* flags */
+		uint32_t _f_data;		/* flags */
 		gid_t _g_data;			/* gid */
 		ino_t _i_data;			/* inode */
 		mode_t _m_data;			/* mode mask */

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.77 src/usr.bin/find/function.c:1.78
--- src/usr.bin/find/function.c:1.77	Tue Sep  4 15:16:15 2018
+++ src/usr.bin/find/function.c	Thu Mar 18 18:21:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.77 2018/09/04 15:16:15 kre Exp $	*/
+/*	$NetBSD: function.c,v 1.78 2021/03/18 18:21:18 cheusov Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)function.c	8.10 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: function.c,v 1.77 2018/09/04 15:16:15 kre Exp $");
+__RCSID("$NetBSD: function.c,v 1.78 2021/03/18 18:21:18 cheusov Exp $");
 #endif
 #endif /* not lint */
 
@@ -960,7 +960,7 @@ c_false(char ***argvp, int isok, char *o
 int
 f_flags(PLAN *plan, FTSENT *entry)
 {
-	u_int32_t flags;
+	uint32_t flags;
 
 	flags = entry->fts_statp->st_flags;
 	if (plan->flags == F_ATLEAST)



CVS commit: src/usr.bin/find

2020-11-01 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Nov  2 07:03:48 UTC 2020

Modified Files:
src/usr.bin/find: find.1

Log Message:
Use \*q to refer to ascii quote to save fontlock from confusion.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.92 src/usr.bin/find/find.1:1.93
--- src/usr.bin/find/find.1:1.92	Sun Nov  1 21:11:49 2020
+++ src/usr.bin/find/find.1	Mon Nov  2 07:03:48 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.92 2020/11/01 21:11:49 kim Exp $
+.\"	$NetBSD: find.1,v 1.93 2020/11/02 07:03:48 uwe Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -141,7 +141,7 @@ is skipped.
 The delimiting characters include single
 .Pq Dq \&'
 and double
-.Pq Dq \&"
+.Pq Dq \&\*q
 quotes, backslash
 .Pq Dq \e ,
 space, tab, and newline characters.



CVS commit: src/usr.bin/find

2020-11-01 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Sun Nov  1 21:11:49 UTC 2020

Modified Files:
src/usr.bin/find: find.1

Log Message:
Bump date (for "-not")


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.91 src/usr.bin/find/find.1:1.92
--- src/usr.bin/find/find.1:1.91	Sun Nov  1 16:47:29 2020
+++ src/usr.bin/find/find.1	Sun Nov  1 21:11:49 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.91 2020/11/01 16:47:29 wiz Exp $
+.\"	$NetBSD: find.1,v 1.92 2020/11/01 21:11:49 kim Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	from: @(#)find.1	8.7 (Berkeley) 5/9/95
 .\"
-.Dd June 13, 2016
+.Dd November 1, 2020
 .Dt FIND 1
 .Os
 .Sh NAME



CVS commit: src/usr.bin/find

2020-11-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Nov  1 16:47:29 UTC 2020

Modified Files:
src/usr.bin/find: find.1

Log Message:
Properly quote '\;' in example.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.90 src/usr.bin/find/find.1:1.91
--- src/usr.bin/find/find.1:1.90	Sun Nov  1 16:34:02 2020
+++ src/usr.bin/find/find.1	Sun Nov  1 16:47:29 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.90 2020/11/01 16:34:02 kim Exp $
+.\"	$NetBSD: find.1,v 1.91 2020/11/01 16:47:29 wiz Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -824,7 +824,7 @@ but do not print them.
 .It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-ls \-exit 1"
 Same as above, but list the first file matching the criteria before exiting
 with a value of 1.
-.It Li "find . \-type f \-exec sh \-c 'file=\*[q]$1\*[q]; ...;' - {} \;"
+.It Li "find . \-type f \-exec sh \-c 'file=\*[q]$1\*[q]; ...;' - {} \e;"
 Perform an arbitrarily complex shell command for every file.
 .El
 .Sh SEE ALSO



CVS commit: src/usr.bin/find

2020-11-01 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Sun Nov  1 16:34:02 UTC 2020

Modified Files:
src/usr.bin/find: find.1

Log Message:
Document the -not operator


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.89 src/usr.bin/find/find.1:1.90
--- src/usr.bin/find/find.1:1.89	Mon Jul  3 21:34:57 2017
+++ src/usr.bin/find/find.1	Sun Nov  1 16:34:02 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.89 2017/07/03 21:34:57 wiz Exp $
+.\"	$NetBSD: find.1,v 1.90 2020/11/01 16:34:02 kim Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -739,6 +739,7 @@ The operators are listed in order of dec
 This evaluates to true if the parenthesized expression evaluates to
 true.
 .It Cm \&! Ar expression
+.It Cm -not Ar expression
 This is the unary
 .Tn NOT
 operator.
@@ -846,7 +847,7 @@ utility syntax is a superset of the synt
 .St -p1003.2
 standard.
 .Pp
-The options and the
+The options, the
 .Ic -amin ,
 .Ic -anewer ,
 .Ic -asince ,
@@ -873,7 +874,9 @@ The options and the
 .Ic -rm ,
 and
 .Ic -since
-primaries are extensions to
+primaries, and the
+.Ic -not
+operator are extensions to
 .St -p1003.2 .
 .Pp
 Historically, the



CVS commit: src/usr.bin/find

2020-10-31 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Nov  1 05:38:29 UTC 2020

Modified Files:
src/usr.bin/find: option.c

Log Message:
add support for '-not': GNU and thus worldly scripts compatibility.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/find/option.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/option.c
diff -u src/usr.bin/find/option.c:1.27 src/usr.bin/find/option.c:1.28
--- src/usr.bin/find/option.c:1.27	Mon Jun 13 00:04:40 2016
+++ src/usr.bin/find/option.c	Sun Nov  1 05:38:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: option.c,v 1.27 2016/06/13 00:04:40 pgoyette Exp $	*/
+/*	$NetBSD: option.c,v 1.28 2020/11/01 05:38:29 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)option.c	8.2 (Berkeley) 4/16/94";
 #else
-__RCSID("$NetBSD: option.c,v 1.27 2016/06/13 00:04:40 pgoyette Exp $");
+__RCSID("$NetBSD: option.c,v 1.28 2020/11/01 05:38:29 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -126,6 +126,8 @@ static OPTION const options[] = {
  */
 
 	{ "-nogroup",	N_NOGROUP,	c_nogroup,	0 },
+/* Alias for compatability with Gnu findutils */
+	{ "-not",	N_NOT,		c_not,		0 },
 	{ "-nouser",	N_NOUSER,	c_nouser,	0 },
 	{ "-o",		N_OR,		c_or,		0 },
 	{ "-ok",	N_OK,		c_exec,		1 },



CVS commit: src/usr.bin/find

2018-09-04 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Sep  4 15:16:15 UTC 2018

Modified Files:
src/usr.bin/find: function.c

Log Message:
Inspired by PR pkg/53543

When calculating the length of the args that can be
appended in a "find  -exec something {} +"
usage, remember to allow for the arg pointers, which
form part of what is allowed in ARG_MAX.

>From a fairly empty installation of HEAD on amd64
and with a "/tmp/args" command that simply prints
its arg count, and the length of the arg strings,
with this mod I see ..

netbsd# find / -exec /tmp/args {} +
Argc 5000 Arglen 107645
Argc 5000 Arglen 151324
Argc 5000 Arglen 187725
Argc 5000 Arglen 206591
Argc 5000 Arglen 172909
Argc 5000 Arglen 186264
Argc 5000 Arglen 167906
Argc 2881 Arglen 98260

The upper limit of 5000 args is in the code.

Using the biggest of those, 5000
args, plus 206591 bytes of strings
uses 246591 bytes total (this excludes
the command name, so add a few more).
That's fairly close to the ARG_MAX
of 262144.

On another system (with longer paths) I see:
(this is just a small part of the output, using a
different version of the dummy command, and a
slightly different invocation)

Args: 4546 Len 218030
Args: 4878 Len 217991
Args: 4813 Len 218028
Args: 4803 Len 218029

There, 4878*8 + 217991 == 257015 which is about
as close as we'd want to come to the arg limit.

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.76 src/usr.bin/find/function.c:1.77
--- src/usr.bin/find/function.c:1.76	Tue Jun 13 13:10:32 2017
+++ src/usr.bin/find/function.c	Tue Sep  4 15:16:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.76 2017/06/13 13:10:32 christos Exp $	*/
+/*	$NetBSD: function.c,v 1.77 2018/09/04 15:16:15 kre Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)function.c	8.10 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: function.c,v 1.76 2017/06/13 13:10:32 christos Exp $");
+__RCSID("$NetBSD: function.c,v 1.77 2018/09/04 15:16:15 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -759,7 +759,9 @@ c_exec(char ***argvp, int isok, char *op
 		size_t c, bufsize;
 
 		cnt = ap - *argvp - 1;			/* units are words */
-		new->ep_maxargs = 5000;
+		new->ep_maxargs = ARG_MAX / (sizeof (char *) + 16);
+		if (new->ep_maxargs > 5000)
+			new->ep_maxargs = 5000;
 		new->e_argv = emalloc((cnt + new->ep_maxargs)
 		* sizeof(*new->e_argv));
 
@@ -780,7 +782,9 @@ c_exec(char ***argvp, int isok, char *op
 errx(1, "Arguments too long");
 			new->e_argv[cnt] = *argv;
 		}
-		bufsize = MAXARG - c;
+		if (c + new->ep_maxargs * sizeof (char *) >= MAXARG)
+			errx(1, "Arguments too long");
+		bufsize = MAXARG - c - new->ep_maxargs * sizeof (char *);
 
 		/*
 		 * Allocate, and then initialize current, base, and



CVS commit: src/usr.bin/find

2017-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 13 13:10:32 UTC 2017

Modified Files:
src/usr.bin/find: function.c

Log Message:
PR/52295: Anthony Mallet: find -delete: "relative path not safe" with absolute
paths ... Fix from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.75 src/usr.bin/find/function.c:1.76
--- src/usr.bin/find/function.c:1.75	Sun Jun 12 22:06:44 2016
+++ src/usr.bin/find/function.c	Tue Jun 13 09:10:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.75 2016/06/13 02:06:44 pgoyette Exp $	*/
+/*	$NetBSD: function.c,v 1.76 2017/06/13 13:10:32 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)function.c	8.10 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: function.c,v 1.75 2016/06/13 02:06:44 pgoyette Exp $");
+__RCSID("$NetBSD: function.c,v 1.76 2017/06/13 13:10:32 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -465,7 +465,7 @@ f_delete(PLAN *plan __unused, FTSENT *en
 		errx(1, "-delete: insecure options got turned on");
 
 	/* Potentially unsafe - do not accept relative paths whatsoever */
-	if (strchr(entry->fts_accpath, '/') != NULL)
+	if (entry->fts_level > 0 && strchr(entry->fts_accpath, '/') != NULL)
 		errx(1, "-delete: %s: relative path potentially not safe",
 			entry->fts_accpath);
 



CVS commit: src/usr.bin/find

2017-06-04 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Sun Jun  4 08:48:05 UTC 2017

Modified Files:
src/usr.bin/find: find.1

Log Message:
Fix typo: s/compatability/compatibility/


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.87 src/usr.bin/find/find.1:1.88
--- src/usr.bin/find/find.1:1.87	Mon Jun 13 06:17:19 2016
+++ src/usr.bin/find/find.1	Sun Jun  4 08:48:05 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.87 2016/06/13 06:17:19 wiz Exp $
+.\"	$NetBSD: find.1,v 1.88 2017/06/04 08:48:05 abhinav Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -547,7 +547,7 @@ True if the current file has a more rece
 .Ar file .
 .Pp
 .It Ic -newerXY Ar reference
-For compatability with Gnu findutils.
+For compatibility with Gnu findutils.
 .Bl -column -offset indent ".Sy findutils" ".Sy equivalent"
 .It Sy findutils Ta Sy find
 .It Sy option Ta Sy equivalent



CVS commit: src/usr.bin/find

2016-06-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jun 13 06:17:19 UTC 2016

Modified Files:
src/usr.bin/find: find.1

Log Message:
Remove trailing whitespace. Remove unnecessary quotes.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.86 src/usr.bin/find/find.1:1.87
--- src/usr.bin/find/find.1:1.86	Mon Jun 13 00:04:40 2016
+++ src/usr.bin/find/find.1	Mon Jun 13 06:17:19 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.86 2016/06/13 00:04:40 pgoyette Exp $
+.\"	$NetBSD: find.1,v 1.87 2016/06/13 06:17:19 wiz Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -172,7 +172,7 @@ and neither means
 .Dq exactly Ar n .
 (The argument specified for the
 .Ic -user
-and 
+and
 .Ic -group
 primaries
 are similarly treated if the value is numeric and does not correspond to a
@@ -196,7 +196,7 @@ minutes.
 True if the current file has a more recent last access time than
 .Ar file .
 .Pp
-.It Ic -asince Ar "timestamp"
+.It Ic -asince Ar timestamp
 True if the file last access time is greater than the specified
 .Ar timestamp .
 .Pp
@@ -219,7 +219,7 @@ minutes.
 True if the current file has a more recent last change time than
 .Ar file .
 .Pp
-.It Ic -csince Ar "timestamp"
+.It Ic -csince Ar timestamp
 True if the file last status change time is greater than the specified
 .Ar timestamp .
 .Pp
@@ -673,7 +673,7 @@ basic regular expression
 This is a match on the whole path, not a search for the regular expression
 within the path.
 .Pp
-.It Ic -since Ar "timestamp"
+.It Ic -since Ar timestamp
 True if the file last modification time is more recent than
 .Ar timestamp .
 .Pp



CVS commit: src/usr.bin/find

2016-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 13 02:06:44 UTC 2016

Modified Files:
src/usr.bin/find: function.c

Log Message:
Fix missing quote.  Resolve automated test failure.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.74 src/usr.bin/find/function.c:1.75
--- src/usr.bin/find/function.c:1.74	Mon Jun 13 00:04:40 2016
+++ src/usr.bin/find/function.c	Mon Jun 13 02:06:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.74 2016/06/13 00:04:40 pgoyette Exp $	*/
+/*	$NetBSD: function.c,v 1.75 2016/06/13 02:06:44 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)function.c	8.10 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: function.c,v 1.74 2016/06/13 00:04:40 pgoyette Exp $");
+__RCSID("$NetBSD: function.c,v 1.75 2016/06/13 02:06:44 pgoyette Exp $");
 #endif
 #endif /* not lint */
 
@@ -1168,7 +1168,7 @@ c_group(char ***argvp, int isok, char *o
 	if (g == NULL) {
 		if (atoi(gname) == 0 && gname[0] != '0' &&
 		strcmp(gname, "+0") && strcmp(gname, "-0"))
-			errx(1, %s: %s: no such group", opt, gname);
+			errx(1, "%s: %s: no such group", opt, gname);
 		gid = find_parsenum(new, "-group", gname, NULL);
 
 	} else {



CVS commit: src/usr.bin/find

2016-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 13 00:04:41 UTC 2016

Modified Files:
src/usr.bin/find: extern.h find.1 find.c find.h function.c option.c

Log Message:
Add new primaries -asince, -csince, and -since to compare file's
attributes against a user-specified timestamp (rather than the
attributes of a reference file).

Update the parse routines so they have access to the name of the
option being parsed.  This enables accurate error reporting for
"aliases" of primaries.

Now that aliases work, introduce some aliases for consistency with
Gnu findutils.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/find/extern.h
cvs rdiff -u -r1.85 -r1.86 src/usr.bin/find/find.1
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/find/find.c
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/find/find.h
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/find/function.c
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/find/option.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/extern.h
diff -u src/usr.bin/find/extern.h:1.28 src/usr.bin/find/extern.h:1.29
--- src/usr.bin/find/extern.h:1.28	Thu Jul 19 07:49:30 2007
+++ src/usr.bin/find/extern.h	Mon Jun 13 00:04:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.28 2007/07/19 07:49:30 daniel Exp $	*/
+/*	$NetBSD: extern.h,v 1.29 2016/06/13 00:04:40 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -47,53 +47,56 @@ void	 printlong(char *, char *, struct s
 int	 queryuser(char **);
 void	 show_path(int);
 
-PLAN	*c_amin(char ***, int);
-PLAN	*c_anewer(char ***, int);
-PLAN	*c_atime(char ***, int);
-PLAN	*c_cmin(char ***, int);
-PLAN	*c_cnewer(char ***, int);
-PLAN	*c_ctime(char ***, int);
-PLAN	*c_delete(char ***, int);
-PLAN	*c_depth(char ***, int);
-PLAN	*c_empty(char ***, int);
-PLAN	*c_exec(char ***, int);
-PLAN	*c_execdir(char ***, int);
-PLAN	*c_exit(char ***, int);
-PLAN	*c_false(char ***, int);
-PLAN	*c_flags(char ***, int);
-PLAN	*c_follow(char ***, int);
-PLAN	*c_fprint(char ***, int);
-PLAN	*c_fstype(char ***, int);
-PLAN	*c_group(char ***, int);
-PLAN	*c_iname(char ***, int);
-PLAN	*c_inum(char ***, int);
-PLAN	*c_iregex(char ***, int);
-PLAN	*c_links(char ***, int);
-PLAN	*c_ls(char ***, int);
-PLAN	*c_maxdepth(char ***, int);
-PLAN	*c_mindepth(char ***, int);
-PLAN	*c_mmin(char ***, int);
-PLAN	*c_mtime(char ***, int);
-PLAN	*c_name(char ***, int);
-PLAN	*c_newer(char ***, int);
-PLAN	*c_nogroup(char ***, int);
-PLAN	*c_nouser(char ***, int);
-PLAN	*c_path(char ***, int);
-PLAN	*c_perm(char ***, int);
-PLAN	*c_print(char ***, int);
-PLAN	*c_print0(char ***, int);
-PLAN	*c_printx(char ***, int);
-PLAN	*c_prune(char ***, int);
-PLAN	*c_regex(char ***, int);
-PLAN	*c_size(char ***, int);
-PLAN	*c_type(char ***, int);
-PLAN	*c_user(char ***, int);
-PLAN	*c_xdev(char ***, int);
-PLAN	*c_openparen(char ***, int);
-PLAN	*c_closeparen(char ***, int);
-PLAN	*c_not(char ***, int);
-PLAN	*c_or(char ***, int);
-PLAN	*c_null(char ***, int);
+PLAN	*c_amin(char ***, int, char *);
+PLAN	*c_anewer(char ***, int, char *);
+PLAN	*c_asince(char ***, int, char *);
+PLAN	*c_atime(char ***, int, char *);
+PLAN	*c_cmin(char ***, int, char *);
+PLAN	*c_cnewer(char ***, int, char *);
+PLAN	*c_csince(char ***, int, char *);
+PLAN	*c_ctime(char ***, int, char *);
+PLAN	*c_delete(char ***, int, char *);
+PLAN	*c_depth(char ***, int, char *);
+PLAN	*c_empty(char ***, int, char *);
+PLAN	*c_exec(char ***, int, char *);
+PLAN	*c_execdir(char ***, int, char *);
+PLAN	*c_exit(char ***, int, char *);
+PLAN	*c_false(char ***, int, char *);
+PLAN	*c_flags(char ***, int, char *);
+PLAN	*c_follow(char ***, int, char *);
+PLAN	*c_fprint(char ***, int, char *);
+PLAN	*c_fstype(char ***, int, char *);
+PLAN	*c_group(char ***, int, char *);
+PLAN	*c_iname(char ***, int, char *);
+PLAN	*c_inum(char ***, int, char *);
+PLAN	*c_iregex(char ***, int, char *);
+PLAN	*c_links(char ***, int, char *);
+PLAN	*c_ls(char ***, int, char *);
+PLAN	*c_maxdepth(char ***, int, char *);
+PLAN	*c_mindepth(char ***, int, char *);
+PLAN	*c_mmin(char ***, int, char *);
+PLAN	*c_mtime(char ***, int, char *);
+PLAN	*c_name(char ***, int, char *);
+PLAN	*c_newer(char ***, int, char *);
+PLAN	*c_nogroup(char ***, int, char *);
+PLAN	*c_nouser(char ***, int, char *);
+PLAN	*c_path(char ***, int, char *);
+PLAN	*c_perm(char ***, int, char *);
+PLAN	*c_print(char ***, int, char *);
+PLAN	*c_print0(char ***, int, char *);
+PLAN	*c_printx(char ***, int, char *);
+PLAN	*c_prune(char ***, int, char *);
+PLAN	*c_regex(char ***, int, char *);
+PLAN	*c_since(char ***, int, char *);
+PLAN	*c_size(char ***, int, char *);
+PLAN	*c_type(char ***, int, char *);
+PLAN	*c_user(char ***, int, char *);
+PLAN	*c_xdev(char ***, int, char *);
+PLAN	*c_openparen(char ***, int, char *);
+PLAN	*c_closeparen(char ***, int, char *);
+PLAN	*c_not(char ***, int, char *);
+PLAN	*c_or(char ***, int, char *);
+PLAN	

CVS commit: src/usr.bin/find

2016-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jun 12 22:25:13 UTC 2016

Modified Files:
src/usr.bin/find: find.1

Log Message:
Use .Ic markup for consistency with the rest of the document


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.84 src/usr.bin/find/find.1:1.85
--- src/usr.bin/find/find.1:1.84	Sun Jun 12 22:17:18 2016
+++ src/usr.bin/find/find.1	Sun Jun 12 22:25:13 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.84 2016/06/12 22:17:18 pgoyette Exp $
+.\"	$NetBSD: find.1,v 1.85 2016/06/12 22:25:13 pgoyette Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -171,9 +171,9 @@ a preceding minus sign means
 and neither means
 .Dq exactly Ar n .
 (The argument specified for the
-.Fl user
+.Ic -user
 and 
-.Fl group
+.Ic -group
 primaries
 are similarly treated if the value is numeric and does not correspond to a
 valid user or group name.)



CVS commit: src/usr.bin/find

2016-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jun 12 22:17:18 UTC 2016

Modified Files:
src/usr.bin/find: find.1

Log Message:
Further clarification of the treatment of numeric user and group names.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.83 src/usr.bin/find/find.1:1.84
--- src/usr.bin/find/find.1:1.83	Sun Jun 12 20:50:10 2016
+++ src/usr.bin/find/find.1	Sun Jun 12 22:17:18 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.83 2016/06/12 20:50:10 dholland Exp $
+.\"	$NetBSD: find.1,v 1.84 2016/06/12 22:17:18 pgoyette Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -170,6 +170,13 @@ a preceding minus sign means
 .Dq less than Ar n ,
 and neither means
 .Dq exactly Ar n .
+(The argument specified for the
+.Fl user
+and 
+.Fl group
+primaries
+are similarly treated if the value is numeric and does not correspond to a
+valid user or group name.)
 .Pp
 .Bl -tag -width Ds -compact
 .It Ic -amin Ar n



CVS commit: src/usr.bin/find

2016-06-12 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jun 12 20:50:10 UTC 2016

Modified Files:
src/usr.bin/find: find.1 function.c

Log Message:
Extend the numeric handling for uids with -user to gids with -group, and
document it. Leftover bit of PR 46158.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/usr.bin/find/find.1
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.82 src/usr.bin/find/find.1:1.83
--- src/usr.bin/find/find.1:1.82	Sun Jun 12 03:21:35 2016
+++ src/usr.bin/find/find.1	Sun Jun 12 20:50:10 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.82 2016/06/12 03:21:35 pgoyette Exp $
+.\"	$NetBSD: find.1,v 1.83 2016/06/12 20:50:10 dholland Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -406,7 +406,7 @@ If
 .Ar gname
 is numeric and there is no such group name, then
 .Ar gname
-is treated as a group id.
+is treated as a group id (and considered a numeric argument).
 .Pp
 .It Ic -iname Ar pattern
 True if the last component of the pathname being examined matches
@@ -673,13 +673,13 @@ whiteout
 whiteout
 .El
 .Pp
-.It Ic -user Ar uname
+.It Ic -user Ar username
 True if the file belongs to the user
-.Ar uname .
+.Ar username .
 If
-.Ar uname
-is numeric and there is no such user name, then
-.Ar uname
+.Ar username
+is numeric and there is no such user on the system, then
+.Ar username
 is treated as a user id (and considered a numeric argument).
 .Pp
 .It Ic -xdev

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.72 src/usr.bin/find/function.c:1.73
--- src/usr.bin/find/function.c:1.72	Sat May  4 06:29:32 2013
+++ src/usr.bin/find/function.c	Sun Jun 12 20:50:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.72 2013/05/04 06:29:32 uebayasi Exp $	*/
+/*	$NetBSD: function.c,v 1.73 2016/06/12 20:50:10 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)function.c	8.10 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: function.c,v 1.72 2013/05/04 06:29:32 uebayasi Exp $");
+__RCSID("$NetBSD: function.c,v 1.73 2016/06/12 20:50:10 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -1060,7 +1060,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 *
@@ -1074,15 +1074,19 @@ c_group(char ***argvp, int isok)
 	(*argvp)++;
 	ftsoptions &= ~FTS_NOSTAT;
 
+	new = palloc(N_GROUP, f_group);
 	g = getgrnam(gname);
 	if (g == NULL) {
-		gid = atoi(gname);
-		if (gid == 0 && gname[0] != '0')
+		if (atoi(gname) == 0 && gname[0] != '0' &&
+		strcmp(gname, "+0") && strcmp(gname, "-0"))
 			errx(1, "-group: %s: no such group", gname);
-	} else
+		gid = find_parsenum(new, "-group", gname, NULL);
+
+	} else {
+		new->flags = F_EQUAL;
 		gid = g->gr_gid;
+	}
 
-	new = palloc(N_GROUP, f_group);
 	new->g_data = gid;
 	return (new);
 }



CVS commit: src/usr.bin/find

2016-06-11 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jun 12 03:21:35 UTC 2016

Modified Files:
src/usr.bin/find: find.1

Log Message:
Change -{min,max}depth argument name from n to depth so that the
earlier statement concerning n being prefaced by a plus or minus.
(These exceptions to the +/- rule noted by kre@)

While here, fix markup error.  .Em for emphasis (stress) rather
than .Ar  :)


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.81 src/usr.bin/find/find.1:1.82
--- src/usr.bin/find/find.1:1.81	Sat May 17 11:31:40 2014
+++ src/usr.bin/find/find.1	Sun Jun 12 03:21:35 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: find.1,v 1.81 2014/05/17 11:31:40 apb Exp $
+.\"	$NetBSD: find.1,v 1.82 2016/06/12 03:21:35 pgoyette Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	from: @(#)find.1	8.7 (Berkeley) 5/9/95
 .\"
-.Dd May 17, 2014
+.Dd June 12, 2016
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -96,7 +96,7 @@ By default,
 .Nm
 visits directories in pre-order, i.e., before their contents.
 Note, the default is
-.Ar not
+.Em not
 a breadth-first traversal.
 .It Fl E
 Causes
@@ -460,13 +460,13 @@ displayed preceded by
 The format is identical to that produced by
 .Dq ls -dgils .
 .Pp
-.It Ic -maxdepth Ar n
+.It Ic -maxdepth Ar depth
 True if the current search depth is less than or equal to what is specified in
-.Ar n .
+.Ar depth .
 .Pp
-.It Ic -mindepth Ar n
+.It Ic -mindepth Ar depth
 True if the current search depth is at least what is specified in
-.Ar n .
+.Ar depth .
 .Pp
 .It Ic -mmin Ar n
 True if the difference between the file last modification time and the time



CVS commit: src/usr.bin/find

2014-05-17 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sat May 17 11:31:40 UTC 2014

Modified Files:
src/usr.bin/find: find.1

Log Message:
Add an example with find ... -exec sh -c 


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.80 src/usr.bin/find/find.1:1.81
--- src/usr.bin/find/find.1:1.80	Fri Feb  8 12:50:51 2013
+++ src/usr.bin/find/find.1	Sat May 17 11:31:40 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.80 2013/02/08 12:50:51 wiz Exp $
+.\	$NetBSD: find.1,v 1.81 2014/05/17 11:31:40 apb Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\	from: @(#)find.1	8.7 (Berkeley) 5/9/95
 .\
-.Dd August 26, 2012
+.Dd May 17, 2014
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -783,6 +783,8 @@ but do not print them.
 .It Li find / \e( \-newer ttt \-or \-user wnj \e) \-ls \-exit 1
 Same as above, but list the first file matching the criteria before exiting
 with a value of 1.
+.It Li find . \-type f \-exec sh \-c 'file=\*[q]$1\*[q]; ...;' - {} \;
+Perform an arbitrarily complex shell command for every file.
 .El
 .Sh SEE ALSO
 .Xr chflags 1 ,



CVS commit: src/usr.bin/find

2013-05-04 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sat May  4 06:29:32 UTC 2013

Modified Files:
src/usr.bin/find: find.h function.c

Log Message:
find(1): Compare timestamp in nsec scale in -anewer/-cnewer/-newer.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/find/find.h
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.h
diff -u src/usr.bin/find/find.h:1.24 src/usr.bin/find/find.h:1.25
--- src/usr.bin/find/find.h:1.24	Tue Feb  6 13:25:01 2007
+++ src/usr.bin/find/find.h	Sat May  4 06:29:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: find.h,v 1.24 2007/02/06 13:25:01 elad Exp $	*/
+/*	$NetBSD: find.h,v 1.25 2013/05/04 06:29:32 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -35,6 +35,7 @@
  */
 
 #include regex.h
+#include time.h
 
 /* node type */
 enum ntype {
@@ -71,6 +72,7 @@ typedef struct _plandata {
 		nlink_t _l_data;		/* link count */
 		off_t _o_data;			/* file size */
 		time_t _t_data;			/* time value */
+		struct timespec _ts_data;	/* time value */
 		uid_t _u_data;			/* uid */
 		short _mt_data;			/* mount flags */
 		struct _plandata *_p_data[2];	/* PLAN trees */
@@ -106,6 +108,7 @@ typedef struct _plandata {
 #define	o_data		p_un._o_data
 #define	p_data		p_un._p_data
 #define	t_data		p_un._t_data
+#define	ts_data		p_un._ts_data
 #define	u_data		p_un._u_data
 #define	e_argv		p_un.ex._e_argv
 #define	e_orig		p_un.ex._e_orig

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.71 src/usr.bin/find/function.c:1.72
--- src/usr.bin/find/function.c:1.71	Sun Aug 26 14:26:37 2012
+++ src/usr.bin/find/function.c	Sat May  4 06:29:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.71 2012/08/26 14:26:37 wiz Exp $	*/
+/*	$NetBSD: function.c,v 1.72 2013/05/04 06:29:32 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = from: @(#)function.c	8.10 (Berkeley) 5/4/95;
 #else
-__RCSID($NetBSD: function.c,v 1.71 2012/08/26 14:26:37 wiz Exp $);
+__RCSID($NetBSD: function.c,v 1.72 2013/05/04 06:29:32 uebayasi Exp $);
 #endif
 #endif /* not lint */
 
@@ -218,7 +218,7 @@ int
 f_anewer(PLAN *plan, FTSENT *entry)
 {
 
-	return (entry-fts_statp-st_atime  plan-t_data);
+	return timespeccmp(entry-fts_statp-st_atim, plan-ts_data, );
 }
 
 PLAN *
@@ -234,7 +234,7 @@ c_anewer(char ***argvp, int isok)
 	if (stat(filename, sb))
 		err(1, %s, filename);
 	new = palloc(N_ANEWER, f_anewer);
-	new-t_data = sb.st_atime;
+	new-ts_data = sb.st_atim;
 	return (new);
 }
 
@@ -265,6 +265,7 @@ c_atime(char ***argvp, int isok)
 	TIME_CORRECT(new, N_ATIME);
 	return (new);
 }
+
 /*
  * -cmin n functions --
  *
@@ -304,7 +305,7 @@ int
 f_cnewer(PLAN *plan, FTSENT *entry)
 {
 
-	return (entry-fts_statp-st_ctime  plan-t_data);
+	return timespeccmp(entry-fts_statp-st_ctim, plan-ts_data, );
 }
 
 PLAN *
@@ -320,7 +321,7 @@ c_cnewer(char ***argvp, int isok)
 	if (stat(filename, sb))
 		err(1, %s, filename);
 	new = palloc(N_CNEWER, f_cnewer);
-	new-t_data = sb.st_ctime;
+	new-ts_data = sb.st_ctim;
 	return (new);
 }
 
@@ -1212,6 +1213,7 @@ c_mindepth(char ***argvp, int isok)
 	new-min_data = atoi(arg);
 	return (new);
 }
+
 /*
  * -mmin n functions --
  *
@@ -1239,6 +1241,7 @@ c_mmin(char ***argvp, int isok)
 	TIME_CORRECT(new, N_MMIN);
 	return (new);
 }
+
 /*
  * -mtime n functions --
  *
@@ -1327,7 +1330,7 @@ int
 f_newer(PLAN *plan, FTSENT *entry)
 {
 
-	return (entry-fts_statp-st_mtime  plan-t_data);
+	return timespeccmp(entry-fts_statp-st_mtim, plan-ts_data, );
 }
 
 PLAN *
@@ -1343,7 +1346,7 @@ c_newer(char ***argvp, int isok)
 	if (stat(filename, sb))
 		err(1, %s, filename);
 	new = palloc(N_NEWER, f_newer);
-	new-t_data = sb.st_mtime;
+	new-ts_data = sb.st_mtim;
 	return (new);
 }
 



CVS commit: src/usr.bin/find

2013-02-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Feb  8 12:50:51 UTC 2013

Modified Files:
src/usr.bin/find: find.1

Log Message:
Add serial commas.
From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.79 src/usr.bin/find/find.1:1.80
--- src/usr.bin/find/find.1:1.79	Sat Oct 13 14:18:17 2012
+++ src/usr.bin/find/find.1	Fri Feb  8 12:50:51 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.79 2012/10/13 14:18:17 njoly Exp $
+.\	$NetBSD: find.1,v 1.80 2013/02/08 12:50:51 wiz Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -144,7 +144,7 @@ and double
 .Pq Dq \
 quotes, backslash
 .Pq Dq \e ,
-space, tab and newline characters.
+space, tab, and newline characters.
 Alternatively, the
 .Ic -print0
 or
@@ -211,7 +211,7 @@ was started, rounded up to the next full
 24-hour periods.
 .Pp
 .It Ic -delete
-Delete found files, symbolic links and directories.
+Delete found files, symbolic links, and directories.
 Always returns true.
 This executes from the current working directory as
 .Nm



CVS commit: src/usr.bin/find

2013-01-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 24 17:50:08 UTC 2013

Modified Files:
src/usr.bin/find: main.c

Log Message:
use O_CLOEXEC, wrap long line.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/find/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/main.c
diff -u src/usr.bin/find/main.c:1.30 src/usr.bin/find/main.c:1.31
--- src/usr.bin/find/main.c:1.30	Fri Sep 16 11:39:25 2011
+++ src/usr.bin/find/main.c	Thu Jan 24 12:50:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.30 2011/09/16 15:39:25 joerg Exp $	*/
+/*	$NetBSD: main.c,v 1.31 2013/01/24 17:50:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -39,7 +39,7 @@ static char sccsid[] = @(#)main.c	8.4 (
 #else
 __COPYRIGHT(@(#) Copyright (c) 1990, 1993, 1994\
  The Regents of the University of California.  All rights reserved.);
-__RCSID($NetBSD: main.c,v 1.30 2011/09/16 15:39:25 joerg Exp $);
+__RCSID($NetBSD: main.c,v 1.31 2013/01/24 17:50:08 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -148,8 +148,7 @@ main(int argc, char *argv[])
 
 	*p = NULL;
 
-	if ((dotfd = open(., O_RDONLY, 0)) == -1 ||
-	fcntl(dotfd, F_SETFD, FD_CLOEXEC) == -1)
+	if ((dotfd = open(., O_RDONLY | O_CLOEXEC, 0)) == -1)
 		err(1, .);
 
 	exit(find_execute(find_formplan(argv), start));
@@ -159,7 +158,7 @@ static void
 usage(void)
 {
 
-	(void)fprintf(stderr,
-usage: find [-H | -L | -P] [-dEhsXx] [-f file] file [file ...] [expression]\n);
+	(void)fprintf(stderr, Usage: %s [-H | -L | -P] [-dEhsXx] [-f file] 
+	file [file ...] [expression]\n, getprogname());
 	exit(1);
 }



CVS commit: src/usr.bin/find

2012-08-26 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 26 14:26:07 UTC 2012

Modified Files:
src/usr.bin/find: find.1

Log Message:
- improve spelling;
- improve wording;
- complement list of primaries that prevent `-print' from being
  used implicitly;
- bump date.

Patch from Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.77 src/usr.bin/find/find.1:1.78
--- src/usr.bin/find/find.1:1.77	Thu Aug 16 13:34:10 2012
+++ src/usr.bin/find/find.1	Sun Aug 26 14:26:07 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.77 2012/08/16 13:34:10 wiz Exp $
+.\	$NetBSD: find.1,v 1.78 2012/08/26 14:26:07 wiz Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\	from: @(#)find.1	8.7 (Berkeley) 5/9/95
 .\
-.Dd August 16, 2012
+.Dd August 26, 2012
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -212,7 +212,7 @@ was started, rounded up to the next full
 .Pp
 .It Ic -delete
 Delete found files, symbolic links and directories.
-Always returns True.
+Always returns true.
 This executes from the current working directory as
 .Nm
 recurses down the tree.
@@ -223,7 +223,7 @@ returns that contain a
 .Xr ( fts 3
 should not return such pathnames).
 Depth-first traversal processing is implied by this option.
-This can also be invoked as
+This primary can also be invoked as
 .Ic -rm .
 .Pp
 .It Ic -empty
@@ -444,7 +444,7 @@ True if the file has
 links.
 .Pp
 .It Ic -rm
-This is an alias for
+This primary is an alias for
 .Ic -delete .
 .Pp
 .It Ic -ls
@@ -589,14 +589,17 @@ This primary always evaluates to true.
 It prints the pathname of the current file to standard output, followed
 by a newline character.
 If none of
+.Ic -delete ,
 .Ic -exec ,
+.Ic -execdir ,
 .Ic -exit ,
 .Ic -fprint ,
 .Ic -ls ,
 .Ic -ok ,
 .Ic -print0 ,
+.Ic -printx ,
 nor
-.Ic -printx
+.Ic -rm
 is specified, the given expression shall be effectively replaced by
 .Cm \( Ns Ar given\ expression Ns Cm \)
 .Ic -print .



CVS commit: src/usr.bin/find

2012-08-26 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Aug 26 14:26:37 UTC 2012

Modified Files:
src/usr.bin/find: function.c

Log Message:
Make order of words in comment consistent with that within other
comments (helps with search actions).

Patch from Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.70 src/usr.bin/find/function.c:1.71
--- src/usr.bin/find/function.c:1.70	Sat May  5 21:16:16 2012
+++ src/usr.bin/find/function.c	Sun Aug 26 14:26:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.70 2012/05/05 21:16:16 dholland Exp $	*/
+/*	$NetBSD: function.c,v 1.71 2012/08/26 14:26:37 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = from: @(#)function.c	8.10 (Berkeley) 5/4/95;
 #else
-__RCSID($NetBSD: function.c,v 1.70 2012/05/05 21:16:16 dholland Exp $);
+__RCSID($NetBSD: function.c,v 1.71 2012/08/26 14:26:37 wiz Exp $);
 #endif
 #endif /* not lint */
 
@@ -355,7 +355,7 @@ c_ctime(char ***argvp, int isok)
 /*
  * -delete functions --
  *
- *	True always.  Makes its best shot and continues on regardless.
+ *	Always true.  Makes its best shot and continues on regardless.
  */
 int
 f_delete(PLAN *plan __unused, FTSENT *entry)



CVS commit: src/usr.bin/find

2012-08-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Aug 16 13:34:10 UTC 2012

Modified Files:
src/usr.bin/find: find.1

Log Message:
Various improvements:
- remove redundant mentioning of option names within their description;
- improve (and make consistent) punctuation;
- add missing empty line;
- remove superfluous white space;
- extend `-iname' primary description (copying text from `-name');
- general wording improvements;
- improve macro usage;
- remove double spaces from examples (it's readable well without);
- reference re_format(7) in `SEE ALSO' (as it's mentioned in the
  text several times);
- bump date.

From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.76 src/usr.bin/find/find.1:1.77
--- src/usr.bin/find/find.1:1.76	Sat Jul  7 20:45:09 2012
+++ src/usr.bin/find/find.1	Thu Aug 16 13:34:10 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.76 2012/07/07 20:45:09 wiz Exp $
+.\	$NetBSD: find.1,v 1.77 2012/08/16 13:34:10 wiz Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\	from: @(#)find.1	8.7 (Berkeley) 5/9/95
 .\
-.Dd July 7, 2012
+.Dd August 16, 2012
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -67,10 +67,8 @@ of each file in the tree.
 The options are as follows:
 .Bl -tag -width Ds
 .It Fl H
-The
-.Fl H
-option causes the file information and file type (see
-.Xr stat 2 ) ,
+Causes the file information and file type (see
+.Xr stat 2 )
 returned for each symbolic link encountered on the command line to be
 those of the file referenced by the link, not the link itself.
 If the referenced file does not exist, the file information and type will
@@ -78,27 +76,21 @@ be for the link itself.
 File information of all symbolic links not on the command line is that
 of the link itself.
 .It Fl L
-The
-.Fl L
-option causes the file information and file type (see
+Causes the file information and file type (see
 .Xr stat 2 )
 returned for each symbolic link to be those of the file referenced by the
 link, not the link itself.
 If the referenced file does not exist, the file information and type will
 be for the link itself.
 .It Fl P
-The
-.Fl P
-option causes the file information and file type (see
+Causes the file information and file type (see
 .Xr stat 2 )
 returned for each symbolic link to be those of the link itself.
 .It Fl d
-The
-.Fl d
-option causes
+Causes
 .Nm
 to perform a depth-first traversal, i.e., directories
-are visited in post-order and all entries in a directory will be acted
+are visited in post-order, and all entries in a directory will be acted
 on before the directory itself.
 By default,
 .Nm
@@ -107,34 +99,26 @@ Note, the default is
 .Ar not
 a breadth-first traversal.
 .It Fl E
-The
-.Fl E
-option causes
+Causes
 .Ar regexp
 arguments to primaries to be interpreted as extended regular
 expressions (see
 .Xr re_format 7 ) .
 .It Fl f
-The
-.Fl f
-option specifies a file hierarchy for
+Specifies a file hierarchy for
 .Nm
 to traverse.
 File hierarchies may also be specified as the operands immediately
 following the options.
 .It Fl h
-The
-.Fl h
-option causes the file information and file type (see
-.Xr stat 2 ) ,
+Causes the file information and file type (see
+.Xr stat 2 )
 returned for each symbolic link to be those of the file referenced by the
 link, not the link itself.
 If the referenced file does not exist, the file information and type will
 be for the link itself.
 .It Fl s
-The
-.Fl s
-option causes the entries of each directory to be sorted in
+Causes the entries of each directory to be sorted in
 lexicographical order.
 Note that the sorting is done only inside of each directory;
 files in different directories are not sorted.
@@ -146,9 +130,7 @@ which is different from
 .Dq Li find ... \| sort
 order.
 .It Fl X
-The
-.Fl X
-option is a modification to permit
+Modifies the output to permit
 .Nm
 to be safely used in conjunction with
 .Xr xargs 1 .
@@ -171,9 +153,7 @@ primaries can be used to format the outp
 .Xr xargs 1
 can accept.
 .It Fl x
-The
-.Fl x
-option restricts the search to the file system containing the
+Restricts the search to the file system containing the
 directory specified.
 Does not list mount points to other file systems.
 .El
@@ -190,6 +170,7 @@ a preceding minus sign means
 .Dq less than Ar n ,
 and neither means
 .Dq exactly Ar n .
+.Pp
 .Bl -tag -width Ds -compact
 .It Ic -amin Ar n
 True if the difference between the file last access time and the time
@@ -200,7 +181,7 @@ minutes.
 .Pp
 .It Ic -anewer Ar file
 True if the current file has a more recent last access time than
-.Ar file  .
+.Ar file .
 .Pp
 .It Ic -atime Ar n
 True if the difference between the file last access time and the time
@@ -219,7 +200,7 @@ 

CVS commit: src/usr.bin/find

2012-07-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jul  7 20:45:10 UTC 2012

Modified Files:
src/usr.bin/find: find.1

Log Message:
- Even if it may be obvious, actually explain what ``{}'' means
  with ``-exec ... {} +'';
- make wording more consistent;
- bump date.

From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.75 src/usr.bin/find/find.1:1.76
--- src/usr.bin/find/find.1:1.75	Wed Jun 27 22:57:27 2012
+++ src/usr.bin/find/find.1	Sat Jul  7 20:45:09 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.75 2012/06/27 22:57:27 jdf Exp $
+.\	$NetBSD: find.1,v 1.76 2012/07/07 20:45:09 wiz Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\	from: @(#)find.1	8.7 (Berkeley) 5/9/95
 .\
-.Dd June 17, 2012
+.Dd July 7, 2012
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -296,12 +296,12 @@ into sets, and
 .Ar utility
 will be invoked once per set, similar to
 .Xr xargs 1 .
-In this case the parameter
+In this case the string
 .Dq Ic {}
 must appear, and must appear as the last item in the argument list,
 just before the
 .Dq Ic \+
-parameter.
+parameter, and is replaced by the pathnames of the current set of files.
 Each set is limited to no more than 5,000 pathnames,
 and is also limited such that the total number of bytes in the argument
 list does not exceed



CVS commit: src/usr.bin/find

2012-06-27 Thread Julian Fagir
Module Name:src
Committed By:   jdf
Date:   Wed Jun 27 22:31:27 UTC 2012

Modified Files:
src/usr.bin/find: find.1

Log Message:
Various formatting changes:
 * Remove superfluous Pp macro (fixes mandoc(1) warning)
 * use Xr macro instead of Nm where appropriate
 * escape punctuation (so Ic actually 'sees' it) (fixed mandoc(1) warning)
 * remove redundant argument to successive Nm macros
 * remove double spaces

Patch supplied by Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.73 src/usr.bin/find/find.1:1.74
--- src/usr.bin/find/find.1:1.73	Wed Jun 20 17:55:06 2012
+++ src/usr.bin/find/find.1	Wed Jun 27 22:31:26 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.73 2012/06/20 17:55:06 wiz Exp $
+.\	$NetBSD: find.1,v 1.74 2012/06/27 22:31:26 jdf Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -65,7 +65,6 @@ listed below) in terms
 of each file in the tree.
 .Pp
 The options are as follows:
-.Pp
 .Bl -tag -width Ds
 .It Fl H
 The
@@ -154,7 +153,7 @@ option is a modification to permit
 to be safely used in conjunction with
 .Xr xargs 1 .
 If a file name contains any of the delimiting characters used by
-.Nm xargs ,
+.Xr xargs 1 ,
 a diagnostic message is displayed on standard error, and the file
 is skipped.
 The delimiting characters include single
@@ -169,7 +168,7 @@ Alternatively, the
 or
 .Ic -printx
 primaries can be used to format the output in a way that
-.Nm xargs
+.Xr xargs 1
 can accept.
 .It Fl x
 The
@@ -490,7 +489,7 @@ was started, rounded up to the next full
 .Ar n
 24-hour periods.
 .Pp
-.It Ic -ok Ar utility Oo argument ... Oc Ic ;
+.It Ic -ok Ar utility Oo argument ... Oc Ic \;
 The
 .Ic -ok
 primary is similar to the semicolon-terminated
@@ -618,9 +617,9 @@ This primary always evaluates to true.
 It prints the pathname of the current file to standard output,
 with each space, tab, newline, backslash, dollar sign, and single,
 double, or back quotation mark prefixed by a backslash, so the output of
-.Nm find
+.Nm
 can safely be used as input to
-.Nm xargs .
+.Xr xargs 1 .
 .Pp
 .It Ic -prune
 This primary always evaluates to true.
@@ -731,10 +730,10 @@ The second expression is not evaluated i
 .El
 .Pp
 All operands and primaries must be separate arguments to
-.Nm  .
+.Nm .
 Primaries which themselves take arguments expect each argument
 to be a separate argument to
-.Nm  .
+.Nm .
 .Sh EXIT STATUS
 The
 .Nm
@@ -897,7 +896,7 @@ primary does not interact well with othe
 tree traversal options to be changed.
 .Sh HISTORY
 A much simpler
-.Nm find
+.Nm .
 command appeared in First Edition AT\*[Am]T Unix.
 The syntax had become similar to the present version by
 the time of the Fifth Edition.



CVS commit: src/usr.bin/find

2012-06-27 Thread Julian Fagir
Module Name:src
Committed By:   jdf
Date:   Wed Jun 27 22:57:27 UTC 2012

Modified Files:
src/usr.bin/find: find.1

Log Message:
Small fix: Changed 'Nm .' to 'Nm' (introduced by me before).


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.74 src/usr.bin/find/find.1:1.75
--- src/usr.bin/find/find.1:1.74	Wed Jun 27 22:31:26 2012
+++ src/usr.bin/find/find.1	Wed Jun 27 22:57:27 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.74 2012/06/27 22:31:26 jdf Exp $
+.\	$NetBSD: find.1,v 1.75 2012/06/27 22:57:27 jdf Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -896,7 +896,7 @@ primary does not interact well with othe
 tree traversal options to be changed.
 .Sh HISTORY
 A much simpler
-.Nm .
+.Nm
 command appeared in First Edition AT\*[Am]T Unix.
 The syntax had become similar to the present version by
 the time of the Fifth Edition.



CVS commit: src/usr.bin/find

2012-06-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jun 20 17:55:06 UTC 2012

Modified Files:
src/usr.bin/find: find.1

Log Message:
Improve wording and macro usage; bump date.
From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.72 src/usr.bin/find/find.1:1.73
--- src/usr.bin/find/find.1:1.72	Thu Mar 22 07:58:18 2012
+++ src/usr.bin/find/find.1	Wed Jun 20 17:55:06 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.72 2012/03/22 07:58:18 wiz Exp $
+.\	$NetBSD: find.1,v 1.73 2012/06/20 17:55:06 wiz Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\	from: @(#)find.1	8.7 (Berkeley) 5/9/95
 .\
-.Dd September 24, 2011
+.Dd June 17, 2012
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -271,20 +271,20 @@ was executed.
 .Pp
 If the list of arguments is terminated by a semicolon
 .Pq Dq Ic \; ,
-then the
+then
 .Ar utility
 is invoked once per pathname.
 If
 the string
 .Dq Ic {}
-appears anywhere in the utility name or the arguments
+appears one or more times in the utility name or arguments,
 then it is replaced by the pathname of the current file
 (but it need not appear, in which case the pathname
-will not be passed to the
+will not be passed to
 .Ar utility ) .
 The semicolon-terminated form of the
 .Ic -exec
-primary returns true if and only if the
+primary returns true if and only if
 .Ar utility
 exits with a zero exit status.
 Note that the semicolon will have to be escaped on the shell command line
@@ -299,7 +299,8 @@ will be invoked once per set, similar to
 .Xr xargs 1 .
 In this case the parameter
 .Dq Ic {}
-must appear as the last item in the argument list, just before the
+must appear, and must appear as the last item in the argument list,
+just before the
 .Dq Ic \+
 parameter.
 Each set is limited to no more than 5,000 pathnames,
@@ -311,7 +312,7 @@ The plus-terminated form of the
 primary always returns true.
 If the plus-terminated form of the
 .Ic -exec
-primary results in any invocation of the
+primary results in any invocation of
 .Ar utility
 exiting with non-zero exit status, then
 .Nm
@@ -498,7 +499,9 @@ variant of the
 .Ic -exec
 primary, with the exception that
 .Nm
-requests user affirmation for the execution of the utility by printing
+requests user affirmation for the execution of
+.Ar utility
+by printing
 a message to the terminal and reading a response.
 If the response is other than
 .Dq y ,



CVS commit: src/usr.bin/find

2012-05-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat May  5 20:48:51 UTC 2012

Modified Files:
src/usr.bin/find: function.c

Log Message:
typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.68 src/usr.bin/find/function.c:1.69
--- src/usr.bin/find/function.c:1.68	Tue Mar 20 20:34:57 2012
+++ src/usr.bin/find/function.c	Sat May  5 20:48:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.68 2012/03/20 20:34:57 matt Exp $	*/
+/*	$NetBSD: function.c,v 1.69 2012/05/05 20:48:51 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = from: @(#)function.c	8.10 (Berkeley) 5/4/95;
 #else
-__RCSID($NetBSD: function.c,v 1.68 2012/03/20 20:34:57 matt Exp $);
+__RCSID($NetBSD: function.c,v 1.69 2012/05/05 20:48:51 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -638,7 +638,7 @@ c_exec(char ***argvp, int isok)
 
 	/*
 	 * Terminate if we encounter an arg exacty equal to ;, or an
-	 * arg exacty equal to + following an arg exacty equal to
+	 * arg exacty equal to + following an arg exactly equal to
 	 * {}.
 	 */
 	for (ap = argv = *argvp, brace = 0;; ++ap) {



CVS commit: src/usr.bin/find

2012-05-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat May  5 21:16:16 UTC 2012

Modified Files:
src/usr.bin/find: function.c

Log Message:
rest of previous.
BQS: 1. dholland: 0.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.69 src/usr.bin/find/function.c:1.70
--- src/usr.bin/find/function.c:1.69	Sat May  5 20:48:51 2012
+++ src/usr.bin/find/function.c	Sat May  5 21:16:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.69 2012/05/05 20:48:51 dholland Exp $	*/
+/*	$NetBSD: function.c,v 1.70 2012/05/05 21:16:16 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = from: @(#)function.c	8.10 (Berkeley) 5/4/95;
 #else
-__RCSID($NetBSD: function.c,v 1.69 2012/05/05 20:48:51 dholland Exp $);
+__RCSID($NetBSD: function.c,v 1.70 2012/05/05 21:16:16 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -637,8 +637,8 @@ c_exec(char ***argvp, int isok)
 		new-flags |= F_NEEDOK;
 
 	/*
-	 * Terminate if we encounter an arg exacty equal to ;, or an
-	 * arg exacty equal to + following an arg exactly equal to
+	 * Terminate if we encounter an arg exactly equal to ;, or an
+	 * arg exactly equal to + following an arg exactly equal to
 	 * {}.
 	 */
 	for (ap = argv = *argvp, brace = 0;; ++ap) {



CVS commit: src/usr.bin/find

2012-03-18 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Mar 18 17:09:46 UTC 2012

Modified Files:
src/usr.bin/find: find.c

Log Message:
Avoid testing a possibly uninitialized errno value when using -exit.
Closes PR 44973 (change is a somewhat more principled equivalent of
the patch suggested there) although I cannot replicate the reported
behavior unless I explicitly prepare errno with a nonzero value before
the fts_read loop.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/find/find.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.c
diff -u src/usr.bin/find/find.c:1.27 src/usr.bin/find/find.c:1.28
--- src/usr.bin/find/find.c:1.27	Tue Dec 28 15:28:31 2010
+++ src/usr.bin/find/find.c	Sun Mar 18 17:09:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: find.c,v 1.27 2010/12/28 15:28:31 christos Exp $	*/
+/*	$NetBSD: find.c,v 1.28 2012/03/18 17:09:46 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = from: @(#)find.c	8.5 (Berkeley) 8/5/94;
 #else
-__RCSID($NetBSD: find.c,v 1.27 2010/12/28 15:28:31 christos Exp $);
+__RCSID($NetBSD: find.c,v 1.28 2012/03/18 17:09:46 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -258,7 +258,7 @@ find_execute(PLAN *plan, char **paths)
 	}
 
 	sig_unlock(s);
-	if (errno)
+	if (g_entry == NULL  errno)
 		err(1, fts_read);
 	(void)fts_close(tree);
 



CVS commit: src/usr.bin/find

2011-09-24 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sat Sep 24 13:45:43 UTC 2011

Modified Files:
src/usr.bin/find: find.1

Log Message:
Updates to the find(1) man page, based on PR 45381 from Greg Woods,
with additional changes by myself.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.70 src/usr.bin/find/find.1:1.71
--- src/usr.bin/find/find.1:1.70	Thu Sep  9 11:42:13 2010
+++ src/usr.bin/find/find.1	Sat Sep 24 13:45:43 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.70 2010/09/09 11:42:13 wiz Exp $
+.\	$NetBSD: find.1,v 1.71 2011/09/24 13:45:43 apb Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\	from: @(#)find.1	8.7 (Berkeley) 5/9/95
 .\
-.Dd November 6, 2009
+.Dd September 24, 2011
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -179,6 +179,18 @@
 Does not list mount points to other file systems.
 .El
 .Sh PRIMARIES
+All primaries which take a numeric argument of
+.Ar n
+allow the number to be preceded by a plus sign
+.Pq Dq \+
+or a minus sign
+.Pq Dq \- .
+A preceding plus sign means
+.Dq more than Ar n ,
+a preceding minus sign means
+.Dq less than Ar n ,
+and neither means
+.Dq exactly Ar n .
 .Bl -tag -width Ds -compact
 .It Ic -amin Ar n
 True if the difference between the file last access time and the time
@@ -237,77 +249,106 @@
 .It Ic -empty
 True if the current file or directory is empty.
 .Pp
-.It Ic -exec Ar utility Oo argument ... Oc No ;
-.It Ic -exec Ar utility Oo argument ... Oc No {} +
+.It Ic -exec Ar utility Oo argument ... Oc Ic \;
+.It Ic -exec Ar utility Oo argument ... Oc Ic {} Ic \+
 Execute the specified
 .Ar utility
 with the specified arguments.
-The list of arguments is terminated by
-.Dq Li \;
-or
-.Dq Li \+ .
+.Pp
+The list of arguments for
+.Ar utility
+is terminated by a lone semicolon
+.Dq Ic \;
+or plus
+.Dq Ic \+
+character as a separate parameter.
+The command specified by
 .Ar utility
-will be executed from the directory from which
+will be executed with its current working directory being the directory
+from which
 .Nm
 was executed.
 .Pp
-If terminated by a semicolon
-.Pq Dq \; ,
-the
+If the list of arguments is terminated by a semicolon
+.Pq Dq Ic \; ,
+then the
+.Ar utility
+is invoked once per pathname.
+If
+the string
+.Dq Ic {}
+appears anywhere in the utility name or the arguments
+then it is replaced by the pathname of the current file
+(but it need not appear, in which case the pathname
+will not be passed to the
+.Ar utility ) .
+The semicolon-terminated form of the
+.Ic -exec
+primary returns true if and only if the
 .Ar utility
-is invoked once per path.
-If the string
-.Dq {}
-appears anywhere in the utility name or the arguments,
-it is replaced by the pathname of the current file.
-.Pp
-If terminated by a plus sign
-.Pq Dq \+ ,
-the pathnames for which the
-primary is evaluated are aggregated into sets, and
+exits with a zero exit status.
+Note that the semicolon will have to be escaped on the shell command line
+in order to be passed as a parameter.
+.Pp
+If the list of arguments is terminated by a plus sign
+.Pq Dq Ic \+ ,
+then the pathnames for which the primary is evaluated are aggregated
+into sets, and
 .Ar utility
 will be invoked once per set, similar to
 .Xr xargs 1 .
-If any invocation exits with non-zero exit status, then
+In this case the parameter
+.Dq Ic {}
+must appear as the last item in the argument list, just before the
+.Dq Ic \+
+parameter.
+Each set is limited to no more than 5,000 pathnames,
+and is also limited such that the total number of bytes in the argument
+list does not exceed
+.Dv ARG_MAX .
+The plus-terminated form of the
+.Ic -exec
+primary always returns true.
+If the plus-terminated form of the
+.Ic -exec
+primary results in any invocation of the
+.Ar utility
+exiting with non-zero exit status, then
 .Nm
-will eventually do so as well, but this does not cause
+will eventually exit with non-zero status as well,
+but this does not cause
 .Nm
 to exit early.
-The string
-.Dq {}
-must appear, and must appear last.
-Each set is limited to no more than 5,000 pathnames,
-and is also limited such that the invocation of
-.Ar utility
-does not exceed
-.Dv ARG_MAX .
 .Pp
-.It Ic -execdir Ar utility Oo argument ... Oc No ;
+.It Ic -execdir Ar utility Oo argument ... Oc Ic \;
 The
 .Ic -execdir
 primary is similar to the semicolon-terminated
-.Pq Dq \;
+.Pq Dq Ic \;
 variant of the
 .Ic -exec
 primary, with the exception that
 .Ar utility
 will be executed from the directory that holds
 the current file.
-The filename substituted for the string
-.Dq {}
-is not qualified.
+Only the base filename is substituted for the string
+.Dq Ic {} .
 Set aggregation
-.Pq Do \+ Dc termination
+.Pq Do Ic \+ Dc termination
 is not 

CVS commit: src/usr.bin/find

2011-02-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Feb 24 02:55:19 UTC 2011

Modified Files:
src/usr.bin/find: function.c

Log Message:
Don't error out while searching for empty directories, from FreeBSD:

http://lists.freebsd.org/pipermail/svn-src-head/2010-December/022913.html


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.65 src/usr.bin/find/function.c:1.66
--- src/usr.bin/find/function.c:1.65	Thu Jan  6 08:18:42 2011
+++ src/usr.bin/find/function.c	Thu Feb 24 02:55:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.65 2011/01/06 08:18:42 dholland Exp $	*/
+/*	$NetBSD: function.c,v 1.66 2011/02/24 02:55:18 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = from: @(#)function.c	8.10 (Berkeley) 5/4/95;
 #else
-__RCSID($NetBSD: function.c,v 1.65 2011/01/06 08:18:42 dholland Exp $);
+__RCSID($NetBSD: function.c,v 1.66 2011/02/24 02:55:18 jmcneill Exp $);
 #endif
 #endif /* not lint */
 
@@ -453,7 +453,7 @@
 		empty = 1;
 		dir = opendir(entry-fts_accpath);
 		if (dir == NULL)
-			err(1, %s, entry-fts_accpath);
+			return (0);
 		for (dp = readdir(dir); dp; dp = readdir(dir))
 			if (dp-d_name[0] != '.' ||
 			(dp-d_name[1] != '\0' 



CVS commit: src/usr.bin/find

2011-01-06 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Jan  6 08:18:43 UTC 2011

Modified Files:
src/usr.bin/find: function.c

Log Message:
Fix -exec blah blah {} + so it only matches when the {} is last, as
per the standard. Per (brief) discussion on tech-userlevel.

There should really be a form where you can do the equivalent of
-exec blah {} blah +, but I think we're going to need to call it
something other than -exec. As it is it's sort of surprising that the
standards people didn't add a different name -- note what happens if
you try to do something like find ... -exec expr {} + 2 \;.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/function.c
diff -u src/usr.bin/find/function.c:1.64 src/usr.bin/find/function.c:1.65
--- src/usr.bin/find/function.c:1.64	Thu Jul 19 07:49:30 2007
+++ src/usr.bin/find/function.c	Thu Jan  6 08:18:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: function.c,v 1.64 2007/07/19 07:49:30 daniel Exp $	*/
+/*	$NetBSD: function.c,v 1.65 2011/01/06 08:18:42 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = from: @(#)function.c	8.10 (Berkeley) 5/4/95;
 #else
-__RCSID($NetBSD: function.c,v 1.64 2007/07/19 07:49:30 daniel Exp $);
+__RCSID($NetBSD: function.c,v 1.65 2011/01/06 08:18:42 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -646,6 +646,7 @@
 			errx(1, %s: no terminating \;\ or \+\,
 			isok ? -ok : -exec);
 		lastbrace = brace;
+		brace = 0;
 		if (strcmp(*ap, {}) == 0)
 			brace = 1;
 		if (strcmp(*ap, ;) == 0)



CVS commit: src/usr.bin/find

2010-12-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec 28 15:28:31 UTC 2010

Modified Files:
src/usr.bin/find: find.c main.c

Log Message:
only setup siginfo handler if we have a tty.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/find/find.c
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/find/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.c
diff -u src/usr.bin/find/find.c:1.26 src/usr.bin/find/find.c:1.27
--- src/usr.bin/find/find.c:1.26	Mon Dec 27 11:09:46 2010
+++ src/usr.bin/find/find.c	Tue Dec 28 10:28:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: find.c,v 1.26 2010/12/27 16:09:46 christos Exp $	*/
+/*	$NetBSD: find.c,v 1.27 2010/12/28 15:28:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = from: @(#)find.c	8.5 (Berkeley) 8/5/94;
 #else
-__RCSID($NetBSD: find.c,v 1.26 2010/12/27 16:09:46 christos Exp $);
+__RCSID($NetBSD: find.c,v 1.27 2010/12/28 15:28:31 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -159,12 +159,19 @@
 static __inline void
 sig_init(void)
 {
+	struct sigaction sa;
 	notty = !(isatty(STDIN_FILENO) || isatty(STDOUT_FILENO) ||
 	isatty(STDERR_FILENO));
 	if (notty)
 		return;
 	sigemptyset(ss);
 	sigaddset(ss, SIGINFO); /* block SIGINFO */
+
+	memset(sa, 0, sizeof(sa));
+	sa.sa_flags = SA_RESTART;
+	sa.sa_handler = show_path;
+	(void)sigaction(SIGINFO, sa, NULL);
+
 }
 
 static __inline void

Index: src/usr.bin/find/main.c
diff -u src/usr.bin/find/main.c:1.28 src/usr.bin/find/main.c:1.29
--- src/usr.bin/find/main.c:1.28	Mon Jul 21 10:19:22 2008
+++ src/usr.bin/find/main.c	Tue Dec 28 10:28:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.28 2008/07/21 14:19:22 lukem Exp $	*/
+/*	$NetBSD: main.c,v 1.29 2010/12/28 15:28:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -39,7 +39,7 @@
 #else
 __COPYRIGHT(@(#) Copyright (c) 1990, 1993, 1994\
  The Regents of the University of California.  All rights reserved.);
-__RCSID($NetBSD: main.c,v 1.28 2008/07/21 14:19:22 lukem Exp $);
+__RCSID($NetBSD: main.c,v 1.29 2010/12/28 15:28:31 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -50,7 +50,6 @@
 #include errno.h
 #include fcntl.h
 #include fts.h
-#include signal.h
 #include locale.h
 #include stdio.h
 #include stdlib.h
@@ -76,18 +75,12 @@
 int
 main(int argc, char *argv[])
 {
-	struct sigaction sa;
 	char **p, **start;
 	int ch;
 
 	(void)time(now);	/* initialize the time-of-day */
 	(void)setlocale(LC_ALL, );
 
-	memset(sa, 0, sizeof(sa));
-	sa.sa_flags = SA_RESTART;
-	sa.sa_handler = show_path;
-	sigaction(SIGINFO, sa, NULL);
-
 	/* array to hold dir list.  at most (argc - 1) elements. */
 	p = start = malloc(argc * sizeof (char *));
 	if (p == NULL)



CVS commit: src/usr.bin/find

2010-12-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 27 16:09:46 UTC 2010

Modified Files:
src/usr.bin/find: find.c

Log Message:
The SIGINFO changes made the sigprocmask syscalls dominate all the rest:
- Don't bother dealing with signal masks if we are not connected to a tty.
- Compute the blocking mask only once.
- Only do the block-unblock game only when we are going to do something
  (execute, print a warning, etc.)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/find/find.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.c
diff -u src/usr.bin/find/find.c:1.25 src/usr.bin/find/find.c:1.26
--- src/usr.bin/find/find.c:1.25	Tue Sep 25 00:10:12 2007
+++ src/usr.bin/find/find.c	Mon Dec 27 11:09:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: find.c,v 1.25 2007/09/25 04:10:12 lukem Exp $	*/
+/*	$NetBSD: find.c,v 1.26 2010/12/27 16:09:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = from: @(#)find.c	8.5 (Berkeley) 8/5/94;
 #else
-__RCSID($NetBSD: find.c,v 1.25 2007/09/25 04:10:12 lukem Exp $);
+__RCSID($NetBSD: find.c,v 1.26 2010/12/27 16:09:46 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -51,14 +51,13 @@
 #include stdio.h
 #include string.h
 #include stdlib.h
+#include stdbool.h
+#include unistd.h
 
 #include find.h
 
 static int ftscompare(const FTSENT **, const FTSENT **);
 
-static void sig_lock(sigset_t *);
-static void sig_unlock(const sigset_t *);
-
 /*
  * find_formplan --
  *	process the command line and create a plan corresponding to the
@@ -154,20 +153,33 @@
 	return (strcoll((*e1)-fts_name, (*e2)-fts_name));
 }
 
-static void
-sig_lock(sigset_t *s)
+static sigset_t ss;
+static bool notty;
+
+static __inline void
+sig_init(void)
 {
-	sigset_t new;
+	notty = !(isatty(STDIN_FILENO) || isatty(STDOUT_FILENO) ||
+	isatty(STDERR_FILENO));
+	if (notty)
+		return;
+	sigemptyset(ss);
+	sigaddset(ss, SIGINFO); /* block SIGINFO */
+}
 
-	sigemptyset(new);
-	sigaddset(new, SIGINFO); /* block SIGINFO */
-	sigprocmask(SIG_BLOCK, new, s);
+static __inline void
+sig_lock(sigset_t *s)
+{
+	if (notty)
+		return;
+	sigprocmask(SIG_BLOCK, ss, s);
 }
 
-static void
+static __inline void
 sig_unlock(const sigset_t *s)
 {
-
+	if (notty)
+		return;
 	sigprocmask(SIG_SETMASK, s, NULL);
 }
 
@@ -191,9 +203,9 @@
 	if (!(tree = fts_open(paths, ftsoptions, issort ? ftscompare : NULL)))
 		err(1, ftsopen);
 
+	sig_init();
 	sig_lock(s);
-	for (rval = 0; cval  (g_entry = fts_read(tree)) != NULL; sig_lock(s)) {
-		sig_unlock(s);
+	for (rval = 0; cval  (g_entry = fts_read(tree)) != NULL;) {
 		switch (g_entry-fts_info) {
 		case FTS_D:
 			if (isdepth)
@@ -206,17 +218,21 @@
 		case FTS_DNR:
 		case FTS_ERR:
 		case FTS_NS:
+			sig_unlock(s);
 			(void)fflush(stdout);
 			warnx(%s: %s,
 			g_entry-fts_path, strerror(g_entry-fts_errno));
 			rval = 1;
+			sig_lock(s);
 			continue;
 		}
 #define	BADCH	 \t\n\\'\
 		if (isxargs  strpbrk(g_entry-fts_path, BADCH)) {
+			sig_unlock(s);
 			(void)fflush(stdout);
 			warnx(%s: illegal path, g_entry-fts_path);
 			rval = 1;
+			sig_lock(s);
 			continue;
 		}
 
@@ -225,11 +241,13 @@
 		 * false or all have been executed.  This is where we do all
 		 * the work specified by the user on the command line.
 		 */
+		sig_unlock(s);
 		for (p = plan; p  (p-eval)(p, g_entry); p = p-next)
 			if (p-type == N_EXIT) {
 rval = p-exit_val;
 cval = 0;
 			}
+		sig_lock(s);
 	}
 
 	sig_unlock(s);



CVS commit: src/usr.bin/find

2010-09-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Sep  9 11:42:14 UTC 2010

Modified Files:
src/usr.bin/find: find.1

Log Message:
Fix typos found by Ryo HAYASAKA in PR 43857.
While here, split file systems that grew together.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.69 src/usr.bin/find/find.1:1.70
--- src/usr.bin/find/find.1:1.69	Fri Nov  6 21:03:12 2009
+++ src/usr.bin/find/find.1	Thu Sep  9 11:42:13 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.69 2009/11/06 21:03:12 dsl Exp $
+.\	$NetBSD: find.1,v 1.70 2010/09/09 11:42:13 wiz Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -276,8 +276,8 @@
 The string
 .Dq {}
 must appear, and must appear last.
-Each set is limitted to no more than 5,000 pathnames,
-and is also limitted such that the invokation of
+Each set is limited to no more than 5,000 pathnames,
+and is also limited such that the invocation of
 .Ar utility
 does not exceed
 .Dv ARG_MAX .
@@ -303,7 +303,7 @@
 .It Ic -exit Op Ar n
 This primary causes
 .Nm
-to stop traversing the filesystem and exit immediately if a
+to stop traversing the file system and exit immediately if a
 previous condition was met.
 If no value is specified, the exit value will be 0, else
 .Ar n .
@@ -361,7 +361,7 @@
 .Ar type .
 The
 .Xr sysctl 8
-command can be used to find out the types of filesystems
+command can be used to find out the types of file systems
 that are available on the system:
 .Bd -literal -offset indent
 sysctl vfs.generic.fstypes
@@ -708,7 +708,7 @@
 .Nm
 utility normally exits 0 on success, and exits with 1 under certain
 internal error conditions.
-If any invokations of
+If any invocations of
 .Dq Ic -exec Ar ... No +
 primaries return non-zero exit-status, then
 .Nm
@@ -839,7 +839,7 @@
 .Pp
 The
 .Ic -delete
-primary does not interact well with other options that cause the filesystem
+primary does not interact well with other options that cause the file system
 tree traversal options to be changed.
 .Sh HISTORY
 A much simpler



CVS commit: src/usr.bin/find

2009-10-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Oct 15 02:26:38 UTC 2009

Modified Files:
src/usr.bin/find: find.1

Log Message:
Use -compact + explicit .Pp instead of .sp with negative line length.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.bin/find/find.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/find/find.1
diff -u src/usr.bin/find/find.1:1.67 src/usr.bin/find/find.1:1.68
--- src/usr.bin/find/find.1:1.67	Sun Jan  4 12:13:56 2009
+++ src/usr.bin/find/find.1	Thu Oct 15 02:26:38 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: find.1,v 1.67 2009/01/04 12:13:56 wiz Exp $
+.\	$NetBSD: find.1,v 1.68 2009/10/15 02:26:38 joerg Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -179,22 +179,25 @@
 Does not list mount points to other file systems.
 .El
 .Sh PRIMARIES
-.Bl -tag -width Ds
+.Bl -tag -width Ds -compact
 .It Ic -amin Ar n
 True if the difference between the file last access time and the time
 .Nm
 was started, rounded up to the next full minute, is
 .Ar n
 minutes.
+.Pp
 .It Ic -anewer Ar file
 True if the current file has a more recent last access time than
 .Ar file  .
+.Pp
 .It Ic -atime Ar n
 True if the difference between the file last access time and the time
 .Nm
 was started, rounded up to the next full 24-hour period, is
 .Ar n
 24-hour periods.
+.Pp
 .It Ic -cmin Ar n
 True if the difference between the time of last change of file status
 information and the time
@@ -202,9 +205,11 @@
 was started, rounded up to the next full minute, is
 .Ar n
 minutes.
+.Pp
 .It Ic -cnewer Ar file
 True if the current file has a more recent last change time than
 .Ar file  .
+.Pp
 .It Ic -ctime Ar n
 True if the difference between the time of last change of file status
 information and the time
@@ -212,6 +217,7 @@
 was started, rounded up to the next full 24-hour period, is
 .Ar n
 24-hour periods.
+.Pp
 .It Ic -delete
 Delete found files and/or directories.
 Always returns True.
@@ -226,11 +232,11 @@
 Depth-first traversal processing is implied by this option.
 This can also be invoked as
 .Ic -rm .
+.Pp
 .It Ic -empty
 True if the current file or directory is empty.
-.\ The .sp below is probably not the right way to get the desired effect.
+.Pp
 .It Ic -exec Ar utility Oo argument ... Oc No ;
-.sp -1l
 .It Ic -exec Ar utility Oo argument ... Oc No {} +
 Execute the specified
 .Ar utility
@@ -274,6 +280,7 @@
 .Ar utility
 does not exceed
 .Dv ARG_MAX .
+.Pp
 .It Ic -execdir Ar utility Oo argument ... Oc No ;
 The
 .Ic -execdir
@@ -291,6 +298,7 @@
 Set aggregation
 .Pq Do \+ Dc termination
 is not supported.
+.Pp
 .It Ic -exit Op Ar n
 This primary causes
 .Nm
@@ -299,6 +307,7 @@
 If no value is specified, the exit value will be 0, else
 .Ar n .
 Note that other primaries will be evaluated and acted upon before exiting.
+.Pp
 .It Ic -false
 This primary always evaluates to false.
 This can be used following a primary that caused the
@@ -308,6 +317,7 @@
 primary so it can continue to the next expression (using an
 .Cm -or
 operator, for example).
+.Pp
 .It Ic -flags Oo Fl Oc Ns Ar flags
 If
 .Ar flags
@@ -331,8 +341,10 @@
 (See
 .Xr chflags 1
 for more information about file flags.)
+.Pp
 .It Ic -follow
 Follow symbolic links.
+.Pp
 .It Ic -fprint Ar filename
 This primary always evaluates to true.
 This creates
@@ -342,6 +354,7 @@
 It writes the pathname of the current file to this file, followed
 by a newline character.
 The file will be empty if no files are matched.
+.Pp
 .It Ic -fstype Ar type
 True if the file is contained in a file system of type
 .Ar type .
@@ -362,6 +375,7 @@
 .Nm
 is being executed, and the latter matches any file system which is
 mounted read-only.
+.Pp
 .It Ic -group Ar gname
 True if the file belongs to the group
 .Ar gname  .
@@ -370,14 +384,17 @@
 is numeric and there is no such group name, then
 .Ar gname
 is treated as a group id.
+.Pp
 .It Ic -iname Ar pattern
 True if the last component of the pathname being examined
 matches
 .Ar pattern .
 Case insensitive.
+.Pp
 .It Ic -inum Ar n
 True if the file has inode number
 .Ar n  .
+.Pp
 .It Ic -iregex Ar regexp
 True if the path name of the current file matches the case-insensitive
 basic regular expression
@@ -385,13 +402,16 @@
 .Ar regexp .
 This is a match on the whole path, not a search for the regular expression
 within the path.
+.Pp
 .It Ic -links Ar n
 True if the file has
 .Ar n
 links.
+.Pp
 .It Ic -rm
 This is an alias for
 .Ic -delete .
+.Pp
 .It Ic -ls
 This primary always evaluates to true.
 The following information for the current file is written to standard output:
@@ -404,24 +424,29 @@
 .Dq -\*[Gt] .
 The format is identical to that produced by
 .Dq ls -dgils .
+.Pp
 .It Ic -maxdepth Ar n
 True if the current search depth is less than or equal to what is specified in
 .Ar n .
+.Pp
 .It Ic -mindepth Ar n