Commit Graph

30 Commits

Author SHA1 Message Date
pgoyette cc610a3c94 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.
2016-06-13 00:04:40 +00:00
matt d34c2845b8 Use C89 function definitions 2012-03-20 20:34:57 +00:00
dholland 83889b37fd 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.
2012-03-18 17:09:46 +00:00
christos d6d145ee46 only setup siginfo handler if we have a tty. 2010-12-28 15:28:31 +00:00
christos a6dac2b7b7 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.)
2010-12-27 16:09:46 +00:00
lukem 1db82cf8e6 revert previous thinko 2007-09-25 04:10:12 +00:00
lukem 2212f6b672 remove unnecessary #include 2007-09-25 04:09:03 +00:00
apb 2eed134b40 De-__P(), remove trailing spaces, sprinkle a few const, WARNS=4. 2006-10-11 19:51:10 +00:00
apb b90dcb5d01 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.
2006-10-07 17:04:02 +00:00
jschauma a32f19d465 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@.
2006-02-20 16:31:02 +00:00
reed 4129c05469 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.
2005-10-12 20:03:59 +00:00
heas 59d5c91fe0 Do not skip whiteout files returned by fts_read(), which only returns them if
requested.

Patch from Dave Huang in PR bin/5419.
2004-03-30 22:51:13 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
yamt 0c0dee33b1 protect from signals properly.
(fix crashes when get SIGINFO.)
2003-05-22 15:48:44 +00:00
yamt 9847a81452 rename a global variable, 'entry', to 'g_entry'.
it was confusing because we have many local 'entry' variable.
2003-05-22 15:47:25 +00:00
provos 9972ef9ff8 support for -empty, -execdir, -mindepth, -maxdepth to match other UNIX-like
systems.  based on work by tholo@openbsd.org.  approved by perry.
2002-09-27 15:56:25 +00:00
enami 7b4bdbc144 Cosmetic changes. 2000-03-16 18:44:29 +00:00
kleink 41ab7b6729 Use strcoll() to sort directory entries. 2000-03-10 14:50:36 +00:00
itohy 6baa6f27af Add -s (sort) option, which causes entries in each directory sorted.
Similar to FreeBSD's.
2000-03-10 11:46:04 +00:00
christos 9a80b4fa85 Simplify the function calling code and warnsify. 1998-02-21 22:47:20 +00:00
mrg 7b983ca6d5 merge lite2, sans getvfsbyname in functions.c (waiting on libc) 1998-02-02 14:02:06 +00:00
lukem 403b699b0b fix .Nm usage, deprecate register, mostly WARNSify (needs minor rewrite to fix) 1997-10-19 11:52:12 +00:00
tls 9d225a1783 RCS ID police 1997-01-09 20:18:21 +00:00
mrg 779746748d KNF. 1996-06-23 11:21:48 +00:00
cgd d731b5b8a7 fix behaviour when adding -print 1994-07-18 09:55:31 +00:00
jtc 3dfa59ec4a Merged our bugfixes with the 4.4BSD find from uunet. 1993-12-30 21:15:18 +00:00
jtc 4ffe868003 Remove special case for root-level symlinks. 1993-12-30 20:09:51 +00:00
jtc 99cd400e2e 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.
1993-10-01 01:03:22 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00