Home | History | Annotate | Download | only in find
History log of /src/usr.bin/find/find.c
RevisionDateAuthorComments
 1.30  13-Jun-2016  pgoyette 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.
 1.29  20-Mar-2012  matt Use C89 function definitions
 1.28  18-Mar-2012  dholland 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.
 1.27  28-Dec-2010  christos branches: 1.27.6;
only setup siginfo handler if we have a tty.
 1.26  27-Dec-2010  christos 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.)
 1.25  25-Sep-2007  lukem revert previous thinko
 1.24  25-Sep-2007  lukem remove unnecessary #include
 1.23  11-Oct-2006  apb branches: 1.23.8;
De-__P(), remove trailing spaces, sprinkle a few const, WARNS=4.
 1.22  07-Oct-2006  apb Add support for "find ... -exec ... {} +".

The code is from John Hawkinson in PR 20470. I adapted it to current,
and made some KNF and comment changes.
 1.21  20-Feb-2006  jschauma Add a new primary '-exit n':
This primary causes find to stop traversing the filesystem and
exit immediately if a previous condition was met. If no value is
specified, the exit value will be 0, else n. Note that other
primaries will be evaluated and acted upon before exiting.

Ok matt@, garbled@.
 1.20  12-Oct-2005  reed This adds -fprint function. The primary name "-fprint" (but not the
code) comes from findutils; it behaves the same.

From my manpage addition:

-fprint filename
This primary always evaluates to true. This creates filename or
overwrites the file if it already exists. The file is created at
startup. 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.

Here is an example usage:

find /etc \( -name "*pass*" -fprint file1 \) -o \( -group operator -fprint file2 \) -o -name "w*"

Note that this example will NOT include entry in file2 if it is
matched in first expression. (This also is same behaviour as
findutils, and I have implemented a -false primary to handle that.
I will commit it later.)

This creates the file as command line argument parsing time.
If there is an error somewhere on that line, such as missing values
or mismatched parenthesis, then a file may still be created.
(Even if a later -fprint filename is unwritable.) This is similar
behaviour to findutils. (It has been suggested that this find could
be code to create the files in an extra stage after the command-line
argument parsing and before the actual function processing.)

I will add -fprintx and -fprint0 soon.

This was discussed on tech-userlevel.
 1.19  30-Mar-2004  heas Do not skip whiteout files returned by fts_read(), which only returns them if
requested.

Patch from Dave Huang in PR bin/5419.
 1.18  07-Aug-2003  agc branches: 1.18.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.17  22-May-2003  yamt protect from signals properly.
(fix crashes when get SIGINFO.)
 1.16  22-May-2003  yamt rename a global variable, 'entry', to 'g_entry'.
it was confusing because we have many local 'entry' variable.
 1.15  27-Sep-2002  provos support for -empty, -execdir, -mindepth, -maxdepth to match other UNIX-like
systems. based on work by tholo@openbsd.org. approved by perry.
 1.14  16-Mar-2000  enami Cosmetic changes.
 1.13  10-Mar-2000  kleink Use strcoll() to sort directory entries.
 1.12  10-Mar-2000  itohy Add -s (sort) option, which causes entries in each directory sorted.
Similar to FreeBSD's.
 1.11  21-Feb-1998  christos Simplify the function calling code and warnsify.
 1.10  02-Feb-1998  mrg merge lite2, sans getvfsbyname in functions.c (waiting on libc)
 1.9  19-Oct-1997  lukem fix .Nm usage, deprecate register, mostly WARNSify (needs minor rewrite to fix)
 1.8  09-Jan-1997  tls RCS ID police
 1.7  23-Jun-1996  mrg KNF.
 1.6  18-Jul-1994  cgd fix behaviour when adding -print
 1.5  30-Dec-1993  jtc branches: 1.5.2;
Merged our bugfixes with the 4.4BSD find from uunet.
 1.4  30-Dec-1993  jtc Remove special case for root-level symlinks.
 1.3  01-Oct-1993  jtc Use *->fts_errno instead of errno after fts_read(). The fts manpage
indicates that the fts_errno will be set to the correct value, but there
are no guarentees about errno.
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  01-Sep-1995  jtc imported from 44lite2
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.5.2.1  18-Jul-1994  cgd udpated from trhunk; needed fro release building scripts
 1.18.2.1  31-Mar-2004  tron branches: 1.18.2.1.2;
Pull up revision 1.19 (requested by heas in ticket #25):
Do not skip whiteout files returned by fts_read(), which only returns them if
requested.
Patch from Dave Huang in PR bin/5419.
 1.18.2.1.2.2  11-Oct-2005  reed Revert changes. I accidently committed to netbsd-2.
 1.18.2.1.2.1  11-Oct-2005  reed This adds -fprint function. The primary name "-fprint" (but not the
code) comes from findutils; it behaves the same.

From my manpage addition:

-fprint filename
This primary always evaluates to true. This creates filename or
overwrites the file if it already exists. The file is created at
startup. 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.

Here is an example usage:

find /etc \( -name "*pass*" -fprint file1 \) -o \( -group operator -fprint file2 \) -o -name "w*"

This was discussed on tech-userlevel.

This creates the file as command line argument parsing time.
If there is an error somewhere on that line, such as missing values
or mismatched parenthesis, then a file may still be created.
(Even if a later -fprint filename is unwritable.) This is similar
behaviour to findutils. (It has been suggested that this find could
be code to create the files in an extra stage after the command-line
argument parsing and before the actual function processing.)

I will add -fprintx and -fprint0 soon.
 1.23.8.1  06-Nov-2007  matt sync with HEAD
 1.27.6.1  17-Apr-2012  yamt sync with head

RSS XML Feed