summaryrefslogtreecommitdiffstats
path: root/usr.bin/find/function.c
Commit message (Collapse)AuthorAgeFilesLines
* - Make find(1) WARNS?= 6 cleanssouhlal2005-01-251-2/+2
| | | | | | - Bump to WARNS?= 6 Approved by: stefanf, grehan (mentor)
* Change the 'no terminating ";"' error message to 'no terminating ";" or "+"'tjr2004-07-291-1/+1
| | | | since + is also a valid way to terminate -exec.
* Remove partial support for building this on NetBSD.tjr2004-07-291-2/+0
|
* - introduce a new primary `-depth n', which tests whethereik2004-05-281-7/+47
| | | | | | | | | | | | | | | | | | | | | 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
* Give find(1) the option -acl to locate files with extendedbmilekic2004-04-031-0/+51
| | | | | | | | | | | ACLs. This is similar to what ls(1) can do. It is handy to have it so that it can be used in conjunction with "-exec setfacl {} \;" (to find(1)), among others. This is the submitter's patch, but slightly modified. PR: bin/65016 Submitted by: Christian S.J. Peron <maneo@bsdpro.com>
* Fix all WARNS. Checked with "make WARNS=9". Remove unused file.markm2003-06-141-190/+62
|
* - Introduce a new struct xvfsconf, the userland version of struct vfsconf.mux2002-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - Make getvfsbyname() take a struct xvfsconf *. - Convert several consumers of getvfsbyname() to use struct xvfsconf. - Correct the getvfsbyname.3 manpage. - Create a new vfs.conflist sysctl to dump all the struct xvfsconf in the kernel, and rewrite getvfsbyname() to use this instead of the weird existing API. - Convert some {set,get,end}vfsent() consumers to use the new vfs.conflist sysctl. - Convert a vfsload() call in nfsiod.c to kldload() and remove the useless vfsisloadable() and endvfsent() calls. - Add a warning printf() in vfs_sysctl() to tell people they are using an old userland. After these changes, it's possible to modify struct vfsconf without breaking the binary compatibility. Please note that these changes don't break this compatibility either. When bp will have updated mount_smbfs(8) with the patch I sent him, there will be no more consumers of the {set,get,end}vfsent(), vfsisloadable() and vfsload() API, and I will promptly delete it.
* Account for space used by environment variables in a similar way totjr2002-07-131-8/+12
| | | | xargs(1) when handling -exec ... {} + constructions.
* Support the SysV-style -exec utility args.. {} + function, required bytjr2002-06-021-8/+69
| | | | SUSv3. This is similar to find foo -print0 | xargs -0 utility args.
* Clean up malloc(3)'s argument. Remove casts which do nothing when we'rejmallett2002-05-171-9/+9
| | | | | | | using sizeof() anyway. Use slightly more consistent (per-file) error reporting for malloc(3) returning NULL. If "malloc failed" was being printed, don't use err(3). If a NULL format is being used, use err(3). In one case errx(3) was being used with strerror(3), so just use err(3).
* More consistancy. file system > filesystemtrhodes2002-05-161-1/+1
|
* There is breakage in parsedate, so revert to get_date until this can bemarkm2002-04-021-1/+1
| | | | | | resolved. Reported by: paul
* Fix find -exec with no command specified (i.e.: find . -exec ';')jmallett2002-04-021-0/+3
| | | | | | | PR: bin/36521 Submitted by: Simon 'corecode' Schubert <corecode@corecode.ath.cx> Reviewed by: mike MFC after: 3 days
* Fix SCM IDs.obrien2002-04-011-3/+2
|
* spellingcharnier2002-03-261-3/+3
|
* Restructure for own parsedate (replacement for get_date from CVS).markm2002-03-211-2/+1
| | | | | | Fix up parsedate.y for WARNS=4. Reviewd by: bde (except for parsedate.y diffs)
* Remove __P().markm2002-03-201-5/+5
|
* 1) Remove -Wall from Makefile.dwmalone2002-02-271-40/+46
| | | | | | 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.
* Simplify f_Xtime().ru2001-09-141-24/+11
|
* Bloat find(1) even more, and introduce the conceptru2001-09-141-12/+104
| | | | | | | | 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-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Restore the `-perm +mode' feature.ru2001-08-301-2/+2
| | | | | Broken in the "close a PR" race, in revision 1.30. Note that the patch in the PR did not have this bug!
* 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.
OpenPOWER on IntegriCloud