summaryrefslogtreecommitdiff
path: root/usr.bin/find
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/find')
-rw-r--r--usr.bin/find/extern.h2
-rw-r--r--usr.bin/find/find.133
-rw-r--r--usr.bin/find/find.c19
-rw-r--r--usr.bin/find/function.c1
-rw-r--r--usr.bin/find/main.c8
-rw-r--r--usr.bin/find/operator.c2
6 files changed, 12 insertions, 53 deletions
diff --git a/usr.bin/find/extern.h b/usr.bin/find/extern.h
index cf2d959d5bdf6..a11183d21dc62 100644
--- a/usr.bin/find/extern.h
+++ b/usr.bin/find/extern.h
@@ -83,4 +83,4 @@ PLAN *c_mtime __P((char *));
PLAN *c_not __P((void));
PLAN *c_or __P((void));
-extern int ftsoptions, isdeprecated, isdepth, isoutput, issort, isxargs;
+extern int ftsoptions, isdeprecated, isdepth, isoutput, isxargs;
diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1
index ed958c4f784a7..97578885de6d1 100644
--- a/usr.bin/find/find.1
+++ b/usr.bin/find/find.1
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)find.1 8.7 (Berkeley) 5/9/95
-.\" $Id: find.1,v 1.17 1998/11/29 12:00:06 bde Exp $
+.\" $Id: find.1,v 1.14 1997/10/27 14:25:54 steve Exp $
.\"
.Dd May 9, 1995
.Dt FIND 1
@@ -44,7 +44,7 @@
.Sh SYNOPSIS
.Nm find
.Op Fl H | Fl L | Fl P
-.Op Fl Xdsx
+.Op Fl Xdx
.Op Fl f Ar file
.Op Ar file ...
.Ar expression
@@ -68,8 +68,7 @@ option causes the file information and file type (see
returned for each symbolic link specified on the command line to be
those of the file referenced by the link, not the link itself.
If the referenced file does not exist, the file information and type will
-be for the link itself.
-File information of all symbolic links not on
+be for the link itself. File information of all symbolic links not on
the command line is that of the link itself.
.It Fl L
The
@@ -122,20 +121,6 @@ option specifies a file hierarchy for
to traverse.
File hierarchies may also be specified as the operands immediately
following the options.
-.It Fl s
-The
-.Fl s
-option causes
-.Nm find
-to traverse the file hierarchies in lexicographical order,
-i.e., alphabetical order within each directory.
-Note:
-.Sq find -s
-and
-.So
-find | sort
-.Sc
-may give different results.
.It Fl x
The
.Fl x
@@ -173,13 +158,10 @@ was started, rounded up to the next full 24\-hour period, is
.Ar n
24\-hour periods.
.It Ic -delete
-Delete found files and/or directories.
-Always returns true.
-This executes
+Delete found files and/or directories. Always returns True. This executes
from the current working directory as
.Nm
-recurses down the tree.
-It will not attempt to delete a filename with a ``/''
+recurses down the tree. It will not attempt to delete a filename with a ``/''
character in its pathname relative to "." for security reasons.
Depth\-first traversal processing is implied by this option.
.It Ic -exec Ar utility Op argument ... ;
@@ -202,8 +184,7 @@ primary is identical to the
primary with the exception that
.Ar Utility
will be executed from the directory that holds
-the current file.
-The filename substituted for
+the current file. The filename substituted for
the string ``{}'' is not qualified.
.It Ic -fstype Ar type
True if the file is contained in a file system of type
@@ -526,7 +507,7 @@ option and the
.Pp
The
.Ic -delete
-primary does not interact well with other options that cause the filesystem
+primary do not interact well with other options that cause the filesystem
tree traversal options to be changed.
.Sh HISTORY
A
diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c
index 56e2340345860..8afadf8b2ef13 100644
--- a/usr.bin/find/find.c
+++ b/usr.bin/find/find.c
@@ -50,22 +50,6 @@ static char sccsid[] = "@(#)find.c 8.5 (Berkeley) 8/5/94";
#include "find.h"
-static int find_compare __P((const FTSENT **s1, const FTSENT **s2));
-
-/*
- * find_compare --
- * tell fts_open() how to order the traversal of the hierarchy.
- * This variant gives lexicographical order, i.e., alphabetical
- * order within each directory.
- */
-static int
-find_compare(s1, s2)
- const FTSENT **s1, **s2;
-{
-
- return (strcoll((*s1)->fts_name, (*s2)->fts_name));
-}
-
/*
* find_formplan --
* process the command line and create a "plan" corresponding to the
@@ -171,8 +155,7 @@ find_execute(plan, paths)
PLAN *p;
int rval;
- tree = fts_open(paths, ftsoptions, (issort ? find_compare : NULL));
- if (tree == NULL)
+ if ((tree = fts_open(paths, ftsoptions, (int (*)())NULL)) == NULL)
err(1, "ftsopen");
for (rval = 0; (entry = fts_read(tree)) != NULL;) {
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index d8a590e4e58f0..1ffdd5236186c 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -949,7 +949,6 @@ c_perm(perm)
err(1, "-perm: %s: illegal mode string", perm);
new->m_data = getmode(set, 0);
- free(set);
return (new);
}
diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c
index 21770fbcf4779..49ad226c57eda 100644
--- a/usr.bin/find/main.c
+++ b/usr.bin/find/main.c
@@ -65,7 +65,6 @@ int ftsoptions; /* options for the ftsopen(3) call */
int isdeprecated; /* using deprecated syntax */
int isdepth; /* do directories on post-order visit */
int isoutput; /* user specified output operator */
-int issort; /* do hierarchies in lexicographical order */
int isxargs; /* don't permit xargs delimiting chars */
static void usage __P((void));
@@ -85,7 +84,7 @@ main(argc, argv)
p = start = argv;
Hflag = Lflag = 0;
ftsoptions = FTS_NOSTAT | FTS_PHYSICAL;
- while ((ch = getopt(argc, argv, "HLPXdf:sx")) != -1)
+ while ((ch = getopt(argc, argv, "HLPXdf:x")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@@ -107,9 +106,6 @@ main(argc, argv)
case 'f':
*p++ = optarg;
break;
- case 's':
- issort = 1;
- break;
case 'x':
ftsoptions |= FTS_XDEV;
break;
@@ -155,6 +151,6 @@ static void
usage()
{
(void)fprintf(stderr,
-"usage: find [-H | -L | -P] [-Xdsx] [-f file] [file ...] [expression]\n");
+"usage: find [-H | -L | -P] [-Xdx] [-f file] [file ...] [expression]\n");
exit(1);
}
diff --git a/usr.bin/find/operator.c b/usr.bin/find/operator.c
index 3654bcabd5fa5..d331faf9a5fe0 100644
--- a/usr.bin/find/operator.c
+++ b/usr.bin/find/operator.c
@@ -190,7 +190,7 @@ not_squish(plan)
int notlevel = 1;
node = yanknode(&plan);
- while (node != NULL && node->type == N_NOT) {
+ while ((node != NULL) && (node->type == N_NOT)) {
++notlevel;
node = yanknode(&plan);
}