Commit Graph

213 Commits

Author SHA1 Message Date
Philippe Charnier
3c94f41f51 Do not repeat the name of the flag in its description 2002-08-27 19:14:08 +00:00
Juli Mallett
4a0193d39e Add a unary -not operator ala -false and !, for sake of completeness.
Obtained from:	OpenDarwin
MFC after:	1 week
2002-08-19 02:27:33 +00:00
Juli Mallett
c9776a935f Oops, add -false to the operators list in the manual page for find(1), as added
in revision 1.17 of option.c.

MFC after:	1 week
2002-08-15 18:30:13 +00:00
Juli Mallett
65acff377a Add support for -false instead of '!' cause it can be hard to use that in
some shells, etc., and also for GNU compatability (lack of this broke the
Mono CVS build for me).

MFC after:	1 week
2002-08-15 18:24:55 +00:00
Maxime Henrion
5965373e69 - Introduce a new struct xvfsconf, the userland version of struct vfsconf.
- 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.
2002-08-10 20:19:04 +00:00
Robert Drehmel
6863982a02 - Use MAXLOGNAME - 1 rather than UT_NAMESIZE.
- Remove the inclusion of <utmp.h>.
2002-07-22 11:36:25 +00:00
Tim J. Robbins
a07af81154 Account for space used by environment variables in a similar way to
xargs(1) when handling -exec ... {} + constructions.
2002-07-13 08:08:46 +00:00
Tim J. Robbins
126b0a6341 Indicate that the semicolon that terminates argument lists should be in
its own argument for -ok and -okdir.
2002-06-26 08:03:54 +00:00
Tim J. Robbins
cc81b6b0fb Make it more obvious that the semicolon that terminates -exec and -execdir
argument lists must be in an argument by itself, not on the end of the
previous one.
2002-06-26 07:55:18 +00:00
Tim J. Robbins
5e25d888a8 Support the SysV-style -exec utility args.. {} + function, required by
SUSv3. This is similar to find foo -print0 | xargs -0 utility args.
2002-06-02 12:57:41 +00:00
Ruslan Ermilov
e2f8ed516a mdoc(7) police: markup nits. 2002-05-29 18:26:16 +00:00
Juli Mallett
47bca8b02c Clean up malloc(3)'s argument. Remove casts which do nothing when we're
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).
2002-05-17 05:11:07 +00:00
Tom Rhodes
46c2a2cfa4 More consistancy. file system > filesystem 2002-05-16 02:19:14 +00:00
Philippe Charnier
e8937ba009 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
David E. O'Brien
5e28140a6b Fix to WARNS=2 level.
Tested by:	AXP gcc 3.1
2002-04-15 19:27:41 +00:00
David E. O'Brien
6f98638581 Clean up the 1/2 a** committing from Thu, 3 May 2001 11:05:39 -0700 (PDT).
Since then we have living with a GPL'ed find(1) due to grabbing getdate.y
from src/contrib/cvs and its user of the GPL'ed xtime.h.  I don't even want
to think about how this could have affected people using our source base.

Would it have been too much trouble to do then what I did now?
Copied getdate.y (public domain) to usr.bin/find and change to use
standard system headers.  find(1) now compiles simply with out having
to go to extra effort to do so.

Pointed hat to:	phk
Build fixed on:	gcc 3.1 using platforms
2002-04-14 01:30:20 +00:00
Philippe Charnier
4ed27a6f0a Replace err() with errx(), errno is garbage in this context. 2002-04-12 21:25:16 +00:00
Tom Rhodes
a8d50686f5 find.1 does not encourage users to DTRT when piping to xargs(1)
PR:			36602
Submitted by:		Joshua Goodall <joshua@roughtrade.net>
No objections from:	ru
MFC after:		2 days
2002-04-10 16:39:22 +00:00
Mark Murray
48d09ba63f There is breakage in parsedate, so revert to get_date until this can be
resolved.

Reported by:	paul
2002-04-02 10:45:34 +00:00
Juli Mallett
51b0534f6b Fix find -exec with no command specified (i.e.: find . -exec ';')
PR:		bin/36521
Submitted by:	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
Reviewed by:	mike
MFC after:	3 days
2002-04-02 07:20:56 +00:00
David E. O'Brien
3077469e0c Fix SCM IDs. 2002-04-01 22:56:56 +00:00
David E. O'Brien
3fa1df42da Allow to compile a YACC produced file with GCC 3.1 (which has different
header searching rules for generated files with #line).
2002-04-01 22:55:01 +00:00
Giorgos Keramidas
7e7f3df61d Run find.1 through ispell.
PR:		docs/36601
Submitted by:	Joshua Goodall <joshua@roughtrade.net>
MFC after:	3 days
2002-04-01 12:41:14 +00:00
David Malone
b68d192c3a Change a "/*" within a comment to a "**".
Add a missing include spotted by gcc30.
2002-03-30 13:54:53 +00:00
Philippe Charnier
9725a7b97a spelling 2002-03-26 12:05:35 +00:00
Mark Murray
2a66bf165b Restructure for own parsedate (replacement for get_date from CVS).
Fix up parsedate.y for WARNS=4.

Reviewd by:	bde (except for parsedate.y diffs)
2002-03-21 21:56:05 +00:00
Mark Murray
2309721787 Add a replacement for get_date which is currently being dug out of
CVS's sources.

This is a "public domain" implementation stolen from INN, and is
added unmodified.
2002-03-21 21:43:50 +00:00
Mark Murray
a6565444bd For the sake of consistency, remove an include that is included in
a previous include. All other files in this app do this.
2002-03-20 10:35:51 +00:00
Mark Murray
ecca1f1c0a Remove __P(). 2002-03-20 10:32:05 +00:00
David Malone
e98080b1e6 1) Remove -Wall from Makefile.
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.
2002-02-27 17:57:00 +00:00
Warner Losh
576541a9e6 Fixed divots that I created when I moved prototypes of group_from_gid
and user_from_uid to grp.h and pwd.h.  Update the man pages.

Submitted by: David Malone
Pointy hat to: imp
2002-02-19 00:05:59 +00:00
Ruslan Ermilov
d33321c095 Add a missing comma. 2001-11-20 15:45:29 +00:00
David E. O'Brien
9b4e871a4f Document -depth 2001-10-06 18:07:32 +00:00
Ruslan Ermilov
631a876574 Simplify f_Xtime(). 2001-09-14 13:42:26 +00:00
Ruslan Ermilov
adff4fca3d Bloat find(1) even more, and introduce the concept
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
2001-09-14 12:47:13 +00:00
Ruslan Ermilov
7fd5ee41e3 The implementation of -flags was broken and did not match the (poorly)
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
2001-09-04 16:09:01 +00:00
Ruslan Ermilov
208691fcd8 Sort predicates.
PR:		docs/30237
2001-08-31 15:48:00 +00:00
Ruslan Ermilov
c0ff9709a5 Restore the `-perm +mode' feature.
Broken in the "close a PR" race, in revision 1.30.
Note that the patch in the PR did not have this bug!
2001-08-30 13:17:58 +00:00
David E. O'Brien
f0cb953721 Remove emalloc and expand to the malloc + error checking it was, where used. 2001-07-24 14:12:05 +00:00
David E. O'Brien
065fe72747 Quiet a [useless] compiler warning. 2001-07-23 23:27:28 +00:00
Yaroslav Tykhiy
08274979f3 Clarify the feature that -exec parameters won't get
shell-expanded when the specified utility is run.

MFC after:	5 days
2001-06-29 12:59:20 +00:00
Ruslan Ermilov
bfd1220842 mdoc(7) police: fix markup. 2001-05-16 13:53:19 +00:00
Poul-Henning Kamp
ea92232a82 They add the following commands:
-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>
2001-05-03 18:05:35 +00:00
Andrey A. Chernov
fa2b491527 Don't attempt to parse %c, use nl_langinfo instead 2001-03-21 15:51:50 +00:00
Warner Losh
470b24b584 MAXPATHLEN already accounts for the trailing NUL, so no need to add one in.
In addition, since we pass readlink MAXPATHLEN - 1, we would have never have
used that extra byte anyway.
2001-03-01 05:49:36 +00:00
Ruslan Ermilov
94ad6032c5 mdoc(7) police: restore correct order of references in the SEE ALSO. 2001-02-24 10:30:27 +00:00
Akinori MUSHA
7c1d4b3ae9 Implement the following options and primaries:
-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
2001-02-23 16:20:55 +00:00
Ruslan Ermilov
d0353b836e mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
Peter Wemm
ed1a4621a2 Add the -empty flag, from OpenBSD. It returns true if the directory
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
2001-01-23 11:16:50 +00:00
Ruslan Ermilov
1bfea903ed Prepare for mdoc(7)NG. 2001-01-16 09:39:23 +00:00
Ruslan Ermilov
9b88faecd3 Prepare for mdoc(7)NG. 2000-12-19 16:00:12 +00:00
Ruslan Ermilov
8fe908ef0c mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
Matthew Hunt
45fe9882b0 "minute(s) period(s)" --> "minute(s)" 2000-11-17 23:08:03 +00:00
Eivind Eklund
1e2f8412e0 Make passing unknown fstypes to -fstype result in a warning instead of
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.
2000-07-28 20:02:42 +00:00
Josef Karthauser
141d77b8cb Switch over to using the new fflagstostr and strtofflags library calls. 2000-06-17 14:19:33 +00:00
Ollivier Robert
c4b8db0095 Make find -Wall -Wredundant-decls clean.
Submitted by:	nrahlstr
2000-06-14 07:43:52 +00:00
Ollivier Robert
c76bc8f3bf This patch adds the -mindepth and -maxdepth options to find(1), which
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>
2000-06-12 11:12:41 +00:00
Ollivier Robert
9d2796c3ec The find -perm option currently supports an exact match,
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>
2000-06-12 10:36:52 +00:00
Nik Clayton
3615c24e18 Fix errors in .Xr usage.
PR:             docs/17057
Submitted by:   Submitted by:   Udo Erdelhoff <ue@nathan.ruhr.de>
2000-03-01 10:48:35 +00:00
Josef Karthauser
418d67b0d9 Revert part of the last commit, remove {g|s}etflags from the libc
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
2000-02-05 18:42:36 +00:00
Josef Karthauser
18c0eeddf7 Historically file flags (schg, uschg, etc) have been converted from
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 ;)
2000-01-27 21:17:01 +00:00
Josef Karthauser
cd2a718f1e Added missing DPADD's. Removed unrequired SRCS's.
Obtained from:	bde
2000-01-01 15:44:11 +00:00
Josef Karthauser
edc2844c9f Moved flags_to_string and string_to_flags into libutil. It's used in
many places nowadays.
1999-12-30 13:15:15 +00:00
Ollivier Robert
567664c4a7 Second part of bin/3648: add -flags to search for specific flags.
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>
1999-12-19 15:43:19 +00:00
Bill Fumerola
389017e544 -Wall: remove unused variable, initialize variable to avoid gcc stupidity. 1999-09-06 20:21:19 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Kris Kennaway
b9569cad67 The -perm option takes argument [-]mode, not [-mode]
Obtained from:	NetBSD, by way of OpenBSD
1999-06-06 07:37:18 +00:00
Joseph Koshy
0c101fb2e7 Clarify wording to indicate that the arguments to find(1) are path names
(and can be both files or directories).  Show white space between
"(", ")", "!" and their corresponding `expression' arguments as
expected by the expression parser inside find(1).

Prompted by:	David Honig <David.Honig@idt.com> on freebsd-doc
		Message-Id: <199904132055.NAA09432@justinian.Eng.idt.com>
1999-04-19 08:26:00 +00:00
Bill Fumerola
56f7a84010 Typo - "the -delete primary do not.." -> "the -delete primary does not.."
PR:		docs/9255
Submitted by:	Christian Weisgerber <naddy@bigeye.rhein-neckar.de>
1998-12-31 16:21:51 +00:00
Warner Losh
83268d4dbb Return memory from setmode.
Obtained from: OpenBSD
1998-12-16 04:50:46 +00:00
Bruce Evans
38cecfeb68 Fixed style bugs in previous commit. 1998-11-29 12:17:09 +00:00
Bruce Evans
6df6954824 Fixed English in previous commit. Clarify "lexicographical order".
Don't format paragraphs manually (new sentences not beginning on new
lines give hard-formatted line breaks).
1998-11-29 12:00:06 +00:00
Bruce Evans
1b4db9d1fd Fixed my English fixes. 1998-11-29 11:34:30 +00:00
Bruce Evans
ad04e6130e Fixed style bugs and English in previous commit. 1998-11-29 11:11:07 +00:00
Bruce Evans
154708b405 Fixed disorder and and usage message. Improved English.
Broken in:	previous commit
1998-11-29 10:41:01 +00:00
Bruce Evans
792ca910ad Fixed disordering in previous commit. 1998-11-29 10:08:27 +00:00
Wolfram Schneider
6d0c7e1378 Added a sort option to find(1).
The sort option make it possible to build the locate
database without large (usually 20-100MB) temp files.
1998-11-29 00:54:21 +00:00
Dag-Erling Smørgrav
1fd98d7d88 Calls one or more of malloc(), warn(), err(), syslog(), execlp() or
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
1998-10-13 14:52:33 +00:00
Peter Hawkins
449cc391d9 PR: 7522
Correct bug in the inverse operator optimisation code which caused segv
on ! without a following expression.
1998-08-10 10:29:11 +00:00
Bruce Evans
22694ebad5 Fixed printf format errors. 1998-07-06 21:01:54 +00:00
Warner Losh
c788c9b224 Make sure we pass the length - 1 to readlink, since it adds its own
NUL at the end of the path.

Inspired by: OpenBSD's changes in this area by theo de raadt
1998-06-09 04:10:08 +00:00
Joseph Koshy
41cbb62401 Add cross references for find(1), locate(1), whereis(1) and which(1).
Submitted by: Josh Gillam <josh@quick.net>
PR: docs/6642
1998-05-15 11:22:42 +00:00
Bruce Evans
87f01287d2 Removed definition of _NEW_VFSCONF. The new vfsconf interface is now
the default.
1998-01-20 10:40:18 +00:00
John Birrell
94aacc4fb8 A partial frontal lobotomy for find if using the NetBSD libc which
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.
1998-01-10 21:36:34 +00:00
Steve Price
5a5b7fdd83 Sort option list so that -amin works.
PR:		5171
Submitted by:	Dmitrij Tejblum <tejblum@arc.hq.cti.ru>
1997-11-28 15:48:08 +00:00
Steve Price
f6e4fb22cf Better wording explaining that all single character options
are extensions along with the previous list of primaries.

Suggested by: bde
1997-10-27 14:25:54 +00:00
Steve Price
fcda3c86e1 Offending statement removed from STANDARDS section. From what I
can gather from the Posix spec that I have (which is very old)
all one character options are extensions to Posix.

PR:		docs/4701
1997-10-27 04:22:13 +00:00
Wolfram Schneider
3f5223f84a Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find. 1997-10-13 21:06:22 +00:00
Warner Losh
127d7563c4 Add -execdir which will execute the exec command in the dir of the file
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
1997-08-29 23:09:45 +00:00
John Polstra
5cc6677fdc Eliminate a variable that is set but never used. 1997-05-19 18:16:29 +00:00
John Polstra
3d9a9402b4 Mention that "-P" is the default. 1997-05-19 18:16:00 +00:00
Eivind Eklund
6ad98044a1 it's'' -> its'' where appropriate and typo fixes in time2posix.3.
Closes PR docs/3612.

Submitted by:	Josh Gilliam <soil@quick.net>
1997-05-19 16:33:27 +00:00
Masafumi Max NAKANE
fbe0d04a50 Minor typo.
PR:		3472
Submitted by:	Josh Gilliam <soil@quick.net>
1997-05-02 22:08:10 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Peter Wemm
9d08e419b9 Fix "-fstype local" that was broken by another bugfix in the Lite2 merge.
Submitted by: Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>, PR#3076
1997-03-27 02:36:26 +00:00
Peter Wemm
841484cd42 Merge from Lite2 - use new getvfsbyname() and related changes.
understand whiteouts (FTS_W from fts()).
1997-03-11 13:48:37 +00:00
Joerg Wunsch
704969a28c Fix a gross bug in the ! operator optimization code. The following
kind of expressions caused a dereferencation of an uninitialized malloc
area, yielding wrong expression evaluation at best, and core dumps at
worst (malloc.conf -> AJ):

	find ... ! \( expr1 ! expr2 \) ...
1997-03-10 19:20:39 +00:00
Peter Wemm
c115df18cd Revert $FreeBSD$ to $Id$ 1997-02-22 19:58:13 +00:00
Wolfram Schneider
fa363c34a4 The option "fstype" does not handle the argument "msdos" correctly.
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>
1997-01-28 13:18:46 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Peter Wemm
3598e52ce6 With -delete, don't complain about non-empty directories. Otherwise
"cd /tmp; find . -mtime +7 -delete" is excessively noisy.
1996-10-05 23:47:07 +00:00
Peter Wemm
242ab807c6 For the -delete option, emulate the behavior of "rm -f" when dealing with
user-immutable files.

Requested by: ache
1996-10-05 18:21:05 +00:00
Peter Wemm
abacbbbf01 Implement a -delete option to find. The code is extremely paranoid and
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)
1996-10-04 12:54:07 +00:00
Wolfram Schneider
b8923d4cc0 [HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41
1996-08-29 18:06:19 +00:00
Andrey A. Chernov
bf4fce1a35 Localize it 1996-08-12 11:39:24 +00:00
Bruce Evans
9192bbf46f Use strtoq() instead of strtol() so that large inums, and sizes can be
specified.

Not fixed: specification of large uids and gids; silent truncation of
unrepresentable values.
1996-04-07 12:58:13 +00:00
Garrett Wollman
81e236a01c Don't use printf() for simple strings because it is slow. Closes PR 783.
Submitted by:	Wolfram Schneider <wosch@freebsd.first.gmd.de>
1995-10-16 18:32:35 +00:00
Nate Williams
e9f1a293f1 Simpler fix to the find bug reported by Terry Lambert <terry@lambert.org>
[ 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>
1995-09-12 23:15:33 +00:00
Garrett Wollman
656dcd4316 Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.
1995-08-07 19:17:46 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Garrett Wollman
7cd23434fe Add GNU-style `-print0' primary. This exists so that one can safely
do `find some-nasty-expression -print0 | perl -n0e unlink' and have all
the files actuallly get deleted.  (Using `xargs' and `rm' is not safe.)
1995-05-09 19:02:06 +00:00
Guido van Rooij
dcb8def0e7 Fix completely broken find behaviour:
a find -foo -o -bar would behave like find -bar. The same for -a
This broke (among others) ./etc/security.

Obtained from: NetBSD
1995-02-27 20:52:36 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00