summaryrefslogtreecommitdiffstats
path: root/usr.bin/find/function.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove emalloc and expand to the malloc + error checking it was, where used.obrien2001-07-241-4/+9
|
* They add the following commands:phk2001-05-031-759/+537
| | | | | | | | | | | | | | | | | | | | | -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-1/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | -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-0/+43
| | | | | | | | | | | 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
* Make passing unknown fstypes to -fstype result in a warning instead ofeivind2000-07-281-2/+16
| | | | | | an error. As it was, which find command lines that would work (be accepted at all) was dependent on the presently running kernel, making script writing and porting hard.
* Switch over to using the new fflagstostr and strtofflags library calls.joe2000-06-171-3/+1
|
* Make find -Wall -Wredundant-decls clean.roberto2000-06-141-4/+0
| | | | Submitted by: nrahlstr
* This patch adds the -mindepth and -maxdepth options to find(1), whichroberto2000-06-121-5/+67
| | | | | | | | | | | | 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/+5
| | | | | | | | | | 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>
* Revert part of the last commit, remove {g|s}etflags from the libcjoe2000-02-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | interface, and statically link them to the programs using them. These functions, upon reflection and discussion, are too generically named for a library interface with such specific functionality. Also the api that they use, whilst ok for private use, isn't good enough for a libc function. Additionally there were complications with the build/install-world process. It depends heavily upon xinstall, which got broken by the change in api, and caused bootstrap problems and general mayhem. There is work in progress to address future problems that may be caused by changes in install-chain tools, and better names for {g|s}etflags can be derived when some future program requires them. For now the code has been left in src/lib/libc/gen (it started off in src/bin/ls). It's important to provide library functions for manipulating file flag strings if we ever want this interface to be adopted outside of the source tree, but now isn't necessarily the right moment with 4.0-release just around the corner. Approved: jkh
* Historically file flags (schg, uschg, etc) have been converted fromjoe2000-01-271-3/+1
| | | | | | | | | | | | | | | | | string to u_long and back using two functions, flags_to_string and string_to_flags, which co-existed with 'ls'. As time has progressed more and more other tools have used these private functions to manipulate the file flags. Recently I moved these functions from /usr/src/bin/ls to libutil, but after some discussion with bde it's been decided that they really ought to go in libc. There are two already existing libc functions for manipulating file modes: setmode and getmode. In keeping with these flags_to_string has been renamed getflags and string_to_flags to setflags. The manual page could probably be improved upon ;)
* Second part of bin/3648: add -flags to search for specific flags.roberto1999-12-191-1/+58
| | | | | | | | 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>
* -Wall: remove unused variable, initialize variable to avoid gcc stupidity.billf1999-09-061-1/+3
|
* Return memory from setmode.imp1998-12-161-0/+1
| | | | Obtained from: OpenBSD
* Calls one or more of malloc(), warn(), err(), syslog(), execlp() ordes1998-10-131-2/+2
| | | | | | | | | | | execvp() in the child branch of a vfork(). Changed to use fork() instead. Some of these (mv, find, apply, xargs) might benefit greatly from being rewritten to use vfork() properly. PR: Loosely related to bin/8252 Approved by: jkh and bde
* A partial frontal lobotomy for find if using the NetBSD libc whichjb1998-01-101-0/+2
| | | | | | | | | doesn't know about getvfsbyname() and the vfsconf structure. This disables the -fstype option if compiled with a pre-processor that defines __NetBSD__. With the FreeBSD built pre-processor, find can only be built with the FreeBSD libc. So when running with a NetBSD kernel, FreeBSD's libc will have to return ENOSYS for things that NetBSD doesn't support. That's life in a hybrid world.
* Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find.wosch1997-10-131-0/+98
|
* Add -execdir which will execute the exec command in the dir of the fileimp1997-08-291-0/+100
| | | | | | | 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
* Fix "-fstype local" that was broken by another bugfix in the Lite2 merge.peter1997-03-271-5/+5
| | | | Submitted by: Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>, PR#3076
* Merge from Lite2 - use new getvfsbyname() and related changes.peter1997-03-111-41/+30
| | | | understand whiteouts (FTS_W from fts()).
* The option "fstype" does not handle the argument "msdos" correctly.wosch1997-01-281-7/+4
| | | | | | | | This error results from changing the name for the msdos file system from "pcfs" to "msdos". Close PR #1105 submitted by: Thomas Wintergerst <thomas@lemur.nord.de>, Slaven Rezic <eserte@cs.tu-berlin.de>
* With -delete, don't complain about non-empty directories. Otherwisepeter1996-10-051-1/+1
| | | | "cd /tmp; find . -mtime +7 -delete" is excessively noisy.
* For the -delete option, emulate the behavior of "rm -f" when dealing withpeter1996-10-051-0/+7
| | | | | | user-immutable files. Requested by: ache
* Implement a -delete option to find. The code is extremely paranoid andpeter1996-10-041-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Use strtoq() instead of strtol() so that large inums, and sizes can bebde1996-04-071-4/+4
| | | | | | | specified. Not fixed: specification of large uids and gids; silent truncation of unrepresentable values.
* Don't use printf() for simple strings because it is slow. Closes PR 783.wollman1995-10-161-1/+1
| | | | Submitted by: Wolfram Schneider <wosch@freebsd.first.gmd.de>
* Simpler fix to the find bug reported by Terry Lambert <terry@lambert.org>nate1995-09-121-0/+3
| | | | | | | [ Find to a file vs. to stdout ] produces different output because find does not flush stdout when doing a -print. Submitted by: Jeffrey Hsu <hsu@freefall.freebsd.org>
* Delete bogus referneces to timezone code internal header file `tzfile.h',wollman1995-08-071-5/+4
| | | | which is no longer bogusly installed in /usr/include.
* Remove trailing whitespace.rgrimes1995-05-301-65/+65
|
* Add GNU-style `-print0' primary. This exists so that one can safelywollman1995-05-091-0/+24
| | | | | 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/+1069
OpenPOWER on IntegriCloud