History log of /openbsd-current/usr.bin/find/function.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.55 11-Aug-2023 guenther

Replace use of the old BSD st_*timespec members in struct stat with
the POSIX-standard st_*tim members.

ok millert@


# 1.54 01-Apr-2023 tb

horrible whitespace, mostly on non-code lines. no object change


Revision tags: OPENBSD_7_3_BASE
# 1.53 08-Mar-2023 guenther

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@


# 1.52 07-Mar-2023 guenther

Delete obsolete /* ARGSUSED1 */ lint comments.

ok claudio@ cheloha@ krw@ deraadt@ miod@ millert@


# 1.51 26-Dec-2022 jmc

spelling fixes from paul tagliamonte;
part of a larger diff: i'm committing this separately
as i changed statuses to status;


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.50 23-Nov-2020 halex

The -exec primary is terminated by either ';' or '+', but the latter
only if immediately following a '{}' placeholder. Slightly modify the
error message to indicate so.

Brought up by and discussed with Paul de Weerd, thanks!

ok millert@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.49 09-Apr-2020 jca

Account for environment when computing maximum space used for args

Already done by xargs(1). Pointed out by espie@, ok millert@


# 1.48 09-Apr-2020 jca

find -exec +: use sysconf to find the kernel's idea of ARG_MAX

Using ARG_MAX directly doesn't fly when ARG_MAX gets bumped and the
kernel and userland are not in sync, effectively breaking find -exec +.
Use sysconf(3) as already done in xargs(1).

Spotted by sthen@, ok deraadt@ millert@ sthen@


Revision tags: OPENBSD_6_6_BASE
# 1.47 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.46 16-Sep-2018 millert

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups. OK tb@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.54 01-Apr-2023 tb

horrible whitespace, mostly on non-code lines. no object change


Revision tags: OPENBSD_7_3_BASE
# 1.53 08-Mar-2023 guenther

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@


# 1.52 07-Mar-2023 guenther

Delete obsolete /* ARGSUSED1 */ lint comments.

ok claudio@ cheloha@ krw@ deraadt@ miod@ millert@


# 1.51 26-Dec-2022 jmc

spelling fixes from paul tagliamonte;
part of a larger diff: i'm committing this separately
as i changed statuses to status;


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.50 23-Nov-2020 halex

The -exec primary is terminated by either ';' or '+', but the latter
only if immediately following a '{}' placeholder. Slightly modify the
error message to indicate so.

Brought up by and discussed with Paul de Weerd, thanks!

ok millert@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.49 09-Apr-2020 jca

Account for environment when computing maximum space used for args

Already done by xargs(1). Pointed out by espie@, ok millert@


# 1.48 09-Apr-2020 jca

find -exec +: use sysconf to find the kernel's idea of ARG_MAX

Using ARG_MAX directly doesn't fly when ARG_MAX gets bumped and the
kernel and userland are not in sync, effectively breaking find -exec +.
Use sysconf(3) as already done in xargs(1).

Spotted by sthen@, ok deraadt@ millert@ sthen@


Revision tags: OPENBSD_6_6_BASE
# 1.47 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.46 16-Sep-2018 millert

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups. OK tb@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.53 08-Mar-2023 guenther

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@


# 1.52 07-Mar-2023 guenther

Delete obsolete /* ARGSUSED1 */ lint comments.

ok claudio@ cheloha@ krw@ deraadt@ miod@ millert@


# 1.51 26-Dec-2022 jmc

spelling fixes from paul tagliamonte;
part of a larger diff: i'm committing this separately
as i changed statuses to status;


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.50 23-Nov-2020 halex

The -exec primary is terminated by either ';' or '+', but the latter
only if immediately following a '{}' placeholder. Slightly modify the
error message to indicate so.

Brought up by and discussed with Paul de Weerd, thanks!

ok millert@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.49 09-Apr-2020 jca

Account for environment when computing maximum space used for args

Already done by xargs(1). Pointed out by espie@, ok millert@


# 1.48 09-Apr-2020 jca

find -exec +: use sysconf to find the kernel's idea of ARG_MAX

Using ARG_MAX directly doesn't fly when ARG_MAX gets bumped and the
kernel and userland are not in sync, effectively breaking find -exec +.
Use sysconf(3) as already done in xargs(1).

Spotted by sthen@, ok deraadt@ millert@ sthen@


Revision tags: OPENBSD_6_6_BASE
# 1.47 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.46 16-Sep-2018 millert

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups. OK tb@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.51 26-Dec-2022 jmc

spelling fixes from paul tagliamonte;
part of a larger diff: i'm committing this separately
as i changed statuses to status;


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.50 23-Nov-2020 halex

The -exec primary is terminated by either ';' or '+', but the latter
only if immediately following a '{}' placeholder. Slightly modify the
error message to indicate so.

Brought up by and discussed with Paul de Weerd, thanks!

ok millert@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.49 09-Apr-2020 jca

Account for environment when computing maximum space used for args

Already done by xargs(1). Pointed out by espie@, ok millert@


# 1.48 09-Apr-2020 jca

find -exec +: use sysconf to find the kernel's idea of ARG_MAX

Using ARG_MAX directly doesn't fly when ARG_MAX gets bumped and the
kernel and userland are not in sync, effectively breaking find -exec +.
Use sysconf(3) as already done in xargs(1).

Spotted by sthen@, ok deraadt@ millert@ sthen@


Revision tags: OPENBSD_6_6_BASE
# 1.47 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.46 16-Sep-2018 millert

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups. OK tb@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.50 23-Nov-2020 halex

The -exec primary is terminated by either ';' or '+', but the latter
only if immediately following a '{}' placeholder. Slightly modify the
error message to indicate so.

Brought up by and discussed with Paul de Weerd, thanks!

ok millert@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.49 09-Apr-2020 jca

Account for environment when computing maximum space used for args

Already done by xargs(1). Pointed out by espie@, ok millert@


# 1.48 09-Apr-2020 jca

find -exec +: use sysconf to find the kernel's idea of ARG_MAX

Using ARG_MAX directly doesn't fly when ARG_MAX gets bumped and the
kernel and userland are not in sync, effectively breaking find -exec +.
Use sysconf(3) as already done in xargs(1).

Spotted by sthen@, ok deraadt@ millert@ sthen@


Revision tags: OPENBSD_6_6_BASE
# 1.47 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.46 16-Sep-2018 millert

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups. OK tb@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.49 09-Apr-2020 jca

Account for environment when computing maximum space used for args

Already done by xargs(1). Pointed out by espie@, ok millert@


# 1.48 09-Apr-2020 jca

find -exec +: use sysconf to find the kernel's idea of ARG_MAX

Using ARG_MAX directly doesn't fly when ARG_MAX gets bumped and the
kernel and userland are not in sync, effectively breaking find -exec +.
Use sysconf(3) as already done in xargs(1).

Spotted by sthen@, ok deraadt@ millert@ sthen@


Revision tags: OPENBSD_6_6_BASE
# 1.47 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.46 16-Sep-2018 millert

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups. OK tb@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.48 09-Apr-2020 jca

find -exec +: use sysconf to find the kernel's idea of ARG_MAX

Using ARG_MAX directly doesn't fly when ARG_MAX gets bumped and the
kernel and userland are not in sync, effectively breaking find -exec +.
Use sysconf(3) as already done in xargs(1).

Spotted by sthen@, ok deraadt@ millert@ sthen@


Revision tags: OPENBSD_6_6_BASE
# 1.47 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.46 16-Sep-2018 millert

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups. OK tb@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.47 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.46 16-Sep-2018 millert

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups. OK tb@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.46 16-Sep-2018 millert

Use uid_from_user(3) and gid_from_group(3) in utilities that
do repeated lookups. OK tb@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.45 03-Jan-2017 tedu

add -delete option which can simplify the common case of wanting to delete
lots of files without the arcane -exec or error prone xargs.
code from freebsd.
ok millert


Revision tags: OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.44 18-Apr-2015 deraadt

Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert


# 1.43 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.42 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.41 18-May-2014 espie

use reallocarray
okay chl@, tedu@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.40 20-Apr-2013 deraadt

adjust comment


# 1.39 19-Apr-2013 deraadt

handle large numbers. this fixes time_t beyond 2038, constrains the
range of i_num correctly, and now handles files > 4GB in size on 32-bit
machines.
ok otto millert


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.38 05-Jan-2012 sthen

Fix typos in comment (s,exacty,exactly,)


# 1.37 02-Jan-2012 pascal

Add support for "find ... -exec foo {} \+".

From the manpage:

If terminated by a plus sign (``+''), the pathnames for which the
primary is evaluated are aggregated into sets, and utility will
be invoked once per set, similar to xargs(1). If any invocation
exits with non-zero exit status, then find will eventually do so
as well, but this does not cause find to exit early. The string
``{}'' 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 utility does not exceed ARG_MAX.

Code comes from NetBSD, written by John Hawkinson. Tested by eivinde at
terraplane dot org and myself for quite some time.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.36 01-Dec-2010 millert

Don't error out if we can't opendir() when -empty is used.
Fix by Bakul Shah. OK deraadt@ halex@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.35 09-Dec-2009 millert

We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@


# 1.34 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


# 1.33 16-Sep-2009 millert

Allow -maxdepth 0; noticed by bluhm@


# 1.32 27-Aug-2009 millert

Don't stop traversing a directory hierarchy if we reach SHRT_MAX,
just stop updating fts_level so we don't overflow it. This allows
rm, find, etc to operate on very deep hierarchies. Consumers of
fts(3) do need to be aware that the actual level may be larger
than fts_level. During the next libc major bump we will make
fts_level an int instead of a short. OK deraadt@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 15-Jun-2005 millert

no more whiteouts


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.30 20-Jul-2004 deraadt

ansi; khalek@linuxgamers.net


# 1.29 01-Jul-2004 otto

setmode(3) returns void *, not mode_t *. ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.28 26-Jun-2003 deraadt

bring protypes into scope. this requires some quirky handling, but in
the end everything is much clearer; ok tedu (itojun might like to see
how ifconfig looks after this)


# 1.27 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.26 03-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.25 30-Jun-2002 matthieu

remove local declaration of user_from_uid()/group_from_uid()
ok millert@


# 1.24 03-May-2002 millert

Fix pasto in -anewer and -cnewer options that caused them to behave
as -newer; Dave Horsfall


Revision tags: OPENBSD_3_1_BASE
# 1.23 17-Feb-2002 millert

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)


# 1.22 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.21 19-Nov-2001 mpech

kill more registers

millert@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.20 19-Jul-2000 mickey

new strtofflags/fflagstostr


# 1.19 08-Jul-2000 millert

Add a -flags option similar to -perm but for filke flags (ala
chflags). Adapted from FreeBSD.


# 1.18 07-Jun-2000 deraadt

-iname support; karls@inet.no


Revision tags: OPENBSD_2_7_BASE
# 1.17 04-Dec-1999 millert

o use nanosecond precision with the -newer option
o add -anewer and -cnewer options like GNU find.


Revision tags: OPENBSD_2_6_BASE
# 1.16 04-Oct-1999 millert

If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target
is not a directory. Also close an fd leak introduced in the last
commit.


# 1.15 04-Oct-1999 millert

Move the chdir/fchdir hack so that it is local to the -execdir
function, since that's the only place it needs to be. Doing it for
each function caused problems with multiple directories.


# 1.14 03-Oct-1999 millert

Do not use FTS_CHDIRROOT flag as it is fatally flawed. Instead,
do the chdir ourselves. This fixes a problem with the -execdir option
with multiple relative directories.


Revision tags: OPENBSD_2_5_BASE
# 1.13 17-Mar-1999 espie

Add -W option so -type W gets a chance to work.


Revision tags: OPENBSD_2_4_BASE
# 1.12 26-Sep-1998 deraadt

more setmode() leaks -- kill 'em all


Revision tags: OPENBSD_2_3_BASE
# 1.11 13-Nov-1997 deraadt

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find; wosch


Revision tags: OPENBSD_2_2_BASE
# 1.10 01-Sep-1997 millert

Fix problem with ``find -execdir'' not having the correct initial cwd.
Adds a new flag to fts(3).


# 1.9 30-Jun-1997 millert

Some -Wall cleanliness.


Revision tags: OPENBSD_2_1_BASE
# 1.8 23-Dec-1996 millert

Add -execdir support.


Revision tags: OPENBSD_2_0_BASE
# 1.7 01-Sep-1996 tholo

Add support for -empty


# 1.6 01-Sep-1996 tholo

Add support for -mindepth while at it


# 1.5 31-Aug-1996 tholo

Add support for -maxdepth option


# 1.4 26-Jun-1996 deraadt

rcsid


# 1.3 25-Jun-1996 deraadt

indent nice


# 1.2 28-May-1996 deraadt

support whiteouts; netbsd pr#2394; mike.long@analog.com


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision