Commit Graph

107 Commits

Author SHA1 Message Date
Eitan Adler
6f9b387301 find.1: Add missing whitespace:
Obtained from:	Dragonfly (dee38d02d51cc8316f82b0263158d2546f2398bc)
2015-04-20 02:23:00 +00:00
Jilles Tjoelker
b547523eb4 find: Return normal exit status from -quit.
If there was an error, make the exit status reflect this even if -quit
caused the exit. Formerly, -quit always caused exit(0).

GNU find does the same.
2014-04-13 11:47:17 +00:00
Jilles Tjoelker
7a79617cc1 find: Correctly propagate -exec/-execdir ... {} + exit status.
As per POSIX, the -exec ... {} + primary always returns true, but a non-zero
exit status causes find to return a non-zero exit status itself. GNU does
the same, and also for -execdir ... {} +.

It does not make much sense to return false from the primary only when the
child process happens to be run.

The behaviour for -exec/-execdir ... ; remains unchanged: the primary
returns true or false depending on the exit status, and find's exit status
is unaffected.
2014-04-12 22:36:26 +00:00
Jilles Tjoelker
e810bef741 find: Fix two more problems with -lname and -ilname:
* Do not match symlinks that are followed because of -H or -L. This is
  explicitly documented in GNU find's info file and is like -type l.

* Fix matching symlinks in subdirectories when fts changes directories.

Also, avoid some readlink() calls on files that are obviously not symlinks
(because of fts(3) restrictions, not all of them).

MFC after:	1 week
2014-01-05 23:01:28 +00:00
David Malone
9ed0c92c91 Add an option for finding sparse files.
Reviewed by:	iedowse
MFC after:	3 weeks
2013-03-03 20:10:56 +00:00
Eitan Adler
81b295a17b Use .Nm instead of a self xref
Approved by:	bcr (mentor)
MFC after:	1 week
2012-11-19 15:12:44 +00:00
Eitan Adler
115b335eca Make it clear that amin and friends take + and - options.
PR:		docs/173265
Submitted by:	Anton Shterenlikht <mexas@bristol.ac.uk>
Approved by:	bcr (mentor)
MFC after:	3 days
2012-11-18 16:34:03 +00:00
Dag-Erling Smørgrav
baf0230645 Note that -quit terminates successfully.
Requested by:	jmg@
2012-09-10 07:56:59 +00:00
Dag-Erling Smørgrav
9168a75a66 Document -quit, four and a half years after it was implemented.
MFC after:	3 days
Pointy hat to:	imp@
2012-09-09 13:18:13 +00:00
Jilles Tjoelker
40072dc2b7 find: Implement real -ignore_readdir_race.
If -ignore_readdir_race is present, [ENOENT] errors caused by deleting a
file after find has read its name from a directory are ignored.

Formerly, -ignore_readdir_race did nothing.

PR:		bin/169723
Submitted by:	Valery Khromov and Andrey Ignatov
2012-07-25 21:59:10 +00:00
Jilles Tjoelker
eb55578582 find(1): Move description of -d option to -depth primary.
The nullary -depth primary is standard and the -d option provides little
advantage.

PR:		docs/168885
MFC after:	1 week
2012-06-13 21:53:40 +00:00
Isabell Long
a86224465d Add more description and clarification about the -depth and -d options in
both places where they are mentioned in find(1).

Discussed with:	dougb
PR:		docs/168885
Reported by:	Ronald F. Guilmette (rfg at tristatelogic dot com)
Approved by:	gabor (mentor)
MFC after:	3 days
2012-06-10 22:14:52 +00:00
Eitan Adler
3e0efd2ec4 Fix style nit: don't use leading zero for dates in .Dd
Prompted by:	brueffer
Approved by:	brueffer
MFC after:	3 days
2012-06-05 03:14:39 +00:00
Eitan Adler
5102783b6e Document the limitations of the -delete primary
PR:		bin/166554
Submitted by:	Richard Kettlewell <rjk@greenend.org.uk>
Discussed with:	jilles
Approved by:	bcr
MFC after:	3 days
2012-06-02 03:13:27 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Joel Dahl
126b754db4 Remove superfluous paragraph macro. 2012-03-25 09:19:25 +00:00
Ed Schouten
9f365aa1d6 Get rid of major/minor number distinction.
As of FreeBSD 6, devices can only be opened through devfs. These device
nodes don't have major and minor numbers anymore. The st_rdev field in
struct stat is simply based a copy of st_ino.

Simply display device numbers as hexadecimal, using "%#jx". This is
allowed by POSIX, since it explicitly states things like the following
(example taken from ls(1)):

	"If the file is a character special or block special file, the
	size of the file may be replaced with implementation-defined
	information associated with the device in question."

This makes the output of these commands more compact. For example, ls(1)
now uses approximately four columns less. While there, simplify the
column length calculation from ls(1) by calling snprintf() with a NULL
buffer.

Don't be afraid; if needed one can still obtain individual major/minor
numbers using stat(1).
2011-09-28 18:53:36 +00:00
Glen Barber
be2cad28b3 Move the explanation of using arguments for the PRIMARIES above
the list of PRIMARIES.

PR:		151812
Submitted by:	Jay (jouellette of gmail com)
Patch by:	eadler
MFC after:	1 week
2011-03-10 18:00:47 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Pawel Jakub Dawidek
d740b7c7e8 Better way to find out available file system types is to use lsvfs(1).
Using 'sysctl vfs' is not only ugly, but is also not reliable - not all
file system types create entries in vfs sysctl tree.

Reviewed by:	imp
MFC after:	1 week
2010-03-16 23:19:55 +00:00
Jilles Tjoelker
a05cb85237 Update find(1) man page for -L/-delete interaction.
It is a bit unfortunate that the example to delete broken symlinks now uses
rm(1), but allowing this with -delete would require fixing fts(3) to not
imply FTS_NOCHDIR if FTS_LOGICAL is given (or hacks in the -delete option).

PR:		bin/90687
MFC after:	2 weeks
2009-09-20 16:47:56 +00:00
Ruslan Ermilov
dfab7fb13d Fix SYNOPSIS and usage(). 2008-03-03 08:32:58 +00:00
Ceri Davies
b390c31130 Bump .Dd for revisions 1.83 and 1.84. 2008-02-24 19:52:23 +00:00
Warner Losh
a66a6a2a0c Tag -ilname and -lname as GNU extensions.
Correct their descriptions to indicate that it is the contents of the
symbolic link that are matched.
2008-02-24 19:46:27 +00:00
Warner Losh
46b993ff99 Implement a number of primaries present in GNU find, but not present
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.
2008-02-23 16:29:04 +00:00
Ruslan Ermilov
fbccd9db48 Check in some insignificant fixes obtained as a result of
the translation work.
2007-02-28 10:19:25 +00:00
Ruslan Ermilov
3b0fbd312c Fix the description of the -Btime primary.
Noticed by:	Vadim Goncharov <vadimnuclight tpu.ru>
2006-12-13 17:02:50 +00:00
Ceri Davies
659a728e18 Update the list of POSIX extensions.
PR:		docs/103859
Submitted by:	shaun
MFC after:	1 week
2006-10-08 10:31:44 +00:00
Ruslan Ermilov
cb29445a92 Markup fixes. 2006-09-29 15:20:48 +00:00
Stefan Farfeleder
107f86a291 Document that the pathname(s) following the options need not be given if
-f pathname was specified.
2006-07-18 07:39:22 +00:00
Kirill Ponomarev
5a890aac57 Add the capability for a trailing scale indicator to cause the
specified size to be read in the more familiar units of kilobytes,
megabytes, gigabytes, terabytes and petabytes.

PR:		bin/50988
Submitted by:	Matthew Seaman <m.seaman@infracaninophile.co.uk>
MFC after:	7 days
2006-05-27 18:27:41 +00:00
Ceri Davies
440a24d87d Note that all of the birthtime related primaries are non-standard. 2006-04-04 10:20:16 +00:00
Ceri Davies
bb0d5fd575 Bump .Dd for the birthtime options. 2006-04-03 20:53:34 +00:00
Ceri Davies
31d534254e Add -Btime, -Bnewer, -Bmin, -newerB[Bacmt], -newer[acmt]B options to
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
2006-04-03 20:36:37 +00:00
Ruslan Ermilov
39c59153e9 Markup and wording fixes.
Approved by:	re (blanket)
2005-06-14 11:50:53 +00:00
Tim J. Robbins
ef6c77648a Use rpmatch() instead of checking for responses that begin with 'y'
in queryuser(). This allows users to respond to -ok and -okdir
prompts with any affirmative reply defined by their current locale.
2005-04-02 07:44:12 +00:00
Ruslan Ermilov
4438d91ea2 Scheduled mdoc(7) sweep. 2005-01-11 10:32:52 +00:00
Tim J. Robbins
053e1a39a3 Now that fnmatch() supports multibyte characters, find does too; remove
entry from BUGS section that said otherwise.
2004-07-29 03:24:30 +00:00
Colin Percival
2cb640f6b1 Start new sentence on new line.
Pointed out by:	simon
2004-07-27 22:17:26 +00:00
Colin Percival
dfef91e977 Add a BUGS entry pointing out that -mindepth and -maxdepth are global
options even though they look like primaries.  (This is already documented
in the options themselves, but is sufficiently astonishing that I think it
deserves a BUGS entry as well.)
2004-07-27 21:22:14 +00:00
Colin Percival
ad4876008f Merge the "multibyte not supported" BUG into the pre-existing BUGS
section.

Move the HISTORY section to place it before BUGS rather than after BUGS,
in order to minimize the chance of this error being reproduced in the
future.  (Both mdoc(7) and 63% of manual pages have these sections listed
in this order.)
2004-07-27 21:13:04 +00:00
Ruslan Ermilov
2410103c1d mdoc(7) fixes. 2004-07-07 19:57:16 +00:00
Tim J. Robbins
4f45d81178 Document missing multibyte character support in utilities specified
by POSIX.
2004-07-03 01:28:21 +00:00
Tim J. Robbins
5854077600 Re-add half of UCB copyright notice that went missing in 1.20. 2004-07-03 01:08:03 +00:00
Oliver Eikemeier
1c8329632e - introduce a new primary `-depth n', which tests whether
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
2004-05-28 17:17:15 +00:00
Ruslan Ermilov
54874bb6b9 Bumped document date.
Fixed a bunch of hyphen misspellings.
Fixed one warning.
2004-05-19 09:49:37 +00:00
Oliver Eikemeier
9c61111db8 snafu, exchanged the descriptions of -maxdepth and -mindepth.
Noticed by:	ru
2004-05-16 10:35:14 +00:00
Oliver Eikemeier
d79829af6c -maxdepth and -mindepth are global variables
PR:		66613
Approved by:	ru
MFC after:	3 days
2004-05-14 12:58:13 +00:00
Dag-Erling Smørgrav
47d91ba394 Clarify and correct some compatibility notes.
PR:		65822
2004-04-21 00:42:55 +00:00
Tom Rhodes
53e87059f0 Add -acl and a small blurb about it to the options list.
Update date.
2004-04-07 14:48:30 +00:00