summaryrefslogtreecommitdiffstats
path: root/usr.bin/find/find.h
Commit message (Collapse)AuthorAgeFilesLines
* Implement a number of primaries present in GNU find, but not presentimp2008-02-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in our find. The following are nops because they aren't relevant to our find: -ignore_readdir_race -noignore_readdir_race -noleaf The following aliaes were created: -gid -> -group [2] -uid -> -user [2] -wholename -> -path -iwholename -> ipath -mount -> -xdev -d -> -depth [1] The following new primaries were created: -lname like -name, but matches symbolic links only) -ilname like -lname but case insensitive -quit exit(0) -samefile returns true for hard links to the specified file -true Always true I changed one primary to match GNU find since I think our use of it violates POLA -false Always false (was an alias for -not!) Also, document the '+' modifier for -execdir, as well as all of the above. This was previously implemented. Document the remaining 7 primaries that are in GNU find, but aren't yet implemented in find(1) [1] This was done in GNU find for compatibility with FreeBSD, yet they mixed up command line args and primary args. [2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the normal range thing that. GNU find -user and -uid also take a numberic arg, but don't do the range processing. find(1) does both for -user and -group, so making -uid and -gid aliases is compatible for all non-error cases used in GNU find. While not perfect emulation, this seems a reasonable thing for us.
* The last execution of -exec {} + is not done if the -exec primary iskrion2006-05-141-0/+2
| | | | | | | | | | | not on the top-level -and sequence, e.g. inside of ! or -or. Create a separate linked list of all active -exec {} + primaries and do the last execution for all at termination. PR: bin/79263 Submitted by: Jilles Tjoelker <jilles@stack.nl> MFC after: 7 days
* Add -Btime, -Bnewer, -Bmin, -newerB[Bacmt], -newer[acmt]B options toceri2006-04-031-0/+2
| | | | | | | | | work with the st_birthtime field of struct stat. 'B' has been chosen to match the format specifier from stat(1). Approved by: jhb MFC after: 2 weeks
* - introduce a new primary `-depth n', which tests whethereik2004-05-281-0/+3
| | | | | | | | | | | | | | | | | | | | | the depth of the current file relative to the starting point of the traversal is n. The usual +/- modifiers to the argument apply. - while I'm here, fix -maxdepth in the case of a depth-first traversal Print the top ten maintainers of python module ports (works with p5-* too): find /usr/ports -depth 2 \! -name 'py-*' -prune -o \ -depth 3 -name Makefile -execdir make -VMAINTAINER \; \ | sort | uniq -c | sort -nr | head PR: 66667 Reviewed by: ru, joerg Approved by: joerg MFC after: 2 weeks
* Support the SysV-style -exec utility args.. {} + function, required bytjr2002-06-021-0/+13
| | | | SUSv3. This is similar to find foo -print0 | xargs -0 utility args.
* Remove __P().markm2002-03-201-1/+1
|
* 1) Remove -Wall from Makefile.dwmalone2002-02-271-1/+1
| | | | | | 2) WARNs fixes (rename option to lookup_option to avoid shadowing, rename argv to argv1 to avoid shadowing, const stuff, prototypes, __unused). 3) Remove "register"s.
* Bloat find(1) even more, and introduce the conceptru2001-09-141-0/+1
| | | | | | | | of time units to be used with -[acm]time primaries. Based on patch from Nils M Holm <nmh@t3x.org>. PR: bin/29165, bin/30309
* The implementation of -flags was broken and did not match the (poorly)ru2001-09-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | documented behavior. Only a certain set of file flags were recognized, and "no" flags did not match files that have corresponding flags bits turned off. Fix and extend the -flags functionality as follows: : -flags [-|+]<flags>,<notflags> : The flags are specified using symbolic names (see chflags(1)). : Those with the "no" prefix (except "nodump") are said to be : <notflags>. Flags in <flags> are checked to be set, and flags in : <notflags> are checked to be not set. Note that this is different : from -perm, which only allows the user to specify mode bits that : are set. : : If flags are preceded by a dash (``-''), this primary evaluates : to true if at least all of the bits in <flags> and none of the bits : in <notflags> are set in the file's flags bits. If flags are pre- : ceded by a plus (``+''), this primary evaluates to true if any of : the bits in <flags> is set in the file's flags bits, or any of the : bits in <notflags> is not set in the file's flags bits. Otherwise, : this primary evaluates to true if the bits in <flags> exactly match : the file's flags bits, and none of the <flags> bits match those of : <notflags>. MFC after: 2 weeks
* They add the following commands:phk2001-05-031-33/+38
| | | | | | | | | | | | | | | | | | | | | -anewer -cnewer -mnewer -okdir -newer[acm][acmt] With it, you can form queries like find . -newerct '1 minute ago' -print As an extra bonus, the program is ANSI-fied - the original version relies on some obscure features of K&R C. (This PR was submitted in 1999, and the submittor has kept the patch updated ever since, hats off for him guys, and how about you close a PR ??) PR: 9374 Submitted by: Martin Birgmeier <Martin.Birgmeier@aon.at>
* Implement the following options and primaries:knu2001-02-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | -E Interpret regular expressions followed by -regex and -iregex op- tions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats. -iname pattern Like -name, but the match is case insensitive. -ipath pattern Like -path, but the match is case insensitive. -regex pattern True if the whole path of the file matches pattern using regular expression. To match a file named ``./foo/xyzzy'', you can use the regular expression ``.*/[xyz]*'' or ``.*/foo/.*'', but not ``xyzzy'' or ``/foo/''. -iregex pattern Like -regex, but the match is case insensitive. These are meant to be compatible with other find(1) implementations such as GNU's or NetBSD's except regexp library differences. Reviewed by: sobomax, dcs, and some other people on -current
* Add the -empty flag, from OpenBSD. It returns true if the directorypeter2001-01-231-2/+2
| | | | | | | | | | | is empty. There doesn't appear to be another easy way to do this. mobile# mkdir foo mobile# mkdir foo/bar mobile# mkdir bar mobile# find . -empty ./foo/bar ./bar
* This patch adds the -mindepth and -maxdepth options to find(1), whichroberto2000-06-121-1/+1
| | | | | | | | | | | | behave as in GNU find (and of course as described in the manual page diff included). I think these options would be useful for some people. Some missing $FreeBSD$ tags are also added. The patch was slightly modified (send-pr mangling of TABS). PR: bin/18941 Submitted by: Ben Smithurst <ben@scientia.demon.co.uk>
* The find -perm option currently supports an exact match,roberto2000-06-121-0/+1
| | | | | | | | | | or if the mode is preceded by a '-', it checks for a match in at least the bits specified on the command line. It is often desirable to find things with any execute or setuid or setgid bits set. PR: bin/10169 Submitted by: Monte Mitzelfelt <monte@gonefishing.org>
* Second part of bin/3648: add -flags to search for specific flags.roberto1999-12-191-2/+9
| | | | | | | | I added $FreeBSD$ whicle I was here. The patch wasn't usable anymore due to its age so I adapted it. PR: bin/3648 Submitted by: Martin Birgmeier <mbirg@austria.ds.philips.com>
* Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find.wosch1997-10-131-2/+4
|
* Add -execdir which will execute the exec command in the dir of the fileimp1997-08-291-4/+4
| | | | | | | in question. This change and the fts changes should be merged into 2.2-stable as soon as they are vetted in -current. This should allow cleaning of files in /tmp to be reneabled. Obtained from: OpenBSD
* Implement a -delete option to find. The code is extremely paranoid andpeter1996-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | goes to a fair degree of trouble to enable something like this to be safe: cd /tmp && find . -mtime +7 -delete It removes both files and directories. It does not attempt to remove immutable files (an earlier version I showed to a few people did a chflags and tried to blow away even immutable files. Too risky..) It is thought to be safe because it forces the fts(3) driven descent to only do "minimal risk" stuff. specifically, -follow is disabled, it does checking to see that it chdir'ed to the directory it thought it was going to, it will *not* pass a pathname with a '/' character in it to unlink(), so it should be totally immune to symlink tree races. If it runs into something "fishy", it bails out rather than blunder ahead.. It's better to do that if somebody is trying to compromise security rather than risk giving them an opportunity. Since the unlink()/rmdir() is being called from within the current working directory during the tree descent, there are no fork/exec overheads or races. As a side effect of this paranoia, you cannot do a "find /somewhere/dir -delete", as the last argument to rmdir() is "/somewhere/dir", and the checking won't allow it. Besides, one would use rm -rf for that case anyway. :-) Reviewed by: pst (some time ago, but I've removed the immutable file deletion code that he complained about since he last saw it)
* Add GNU-style `-print0' primary. This exists so that one can safelywollman1995-05-091-0/+1
| | | | | do `find some-nasty-expression -print0 | perl -n0e unlink' and have all the files actuallly get deleted. (Using `xargs' and `rm' is not safe.)
* BSD 4.4 Lite Usr.bin Sourcesrgrimes1994-05-271-0/+107
OpenPOWER on IntegriCloud