SCCS-vsn: usr.bin/find/find.1 6.16
SCCS-vsn: usr.bin/find/function.c 5.9
SCCS-vsn: usr.bin/find/misc.c 5.3
SCCS-vsn: usr.bin/find/main.c 5.3
.\"
.\" %sccs.include.redist.man%
.\"
.\"
.\" %sccs.include.redist.man%
.\"
-.\" @(#)find.1 6.15 (Berkeley) %G%
+.\" @(#)find.1 6.16 (Berkeley) %G%
.Nd walk a file hierarchy
.Sh SYNOPSIS
.Nm find
.Nd walk a file hierarchy
.Sh SYNOPSIS
.Nm find
.Op Ar path
.Ar expression
.Nm find
.Op Ar path
.Ar expression
.Nm find
.Op Fl f Ar path
.Ar expression
.Sh DESCRIPTION
.Op Fl f Ar path
.Ar expression
.Sh DESCRIPTION
-option causes find to perform a depth\-first traversal, i.e. directories
+option causes
+.Nm find
+to perform a depth\-first traversal, i.e. directories
are visited in post\-order and all entries in a directory will be acted
on before the directory itself.
By default,
are visited in post\-order and all entries in a directory will be acted
on before the directory itself.
By default,
.Fl f
option is specified, the first operand after the options is
expected to be the file hierarchy to be traversed.
.Fl f
option is specified, the first operand after the options is
expected to be the file hierarchy to be traversed.
+.Tp Fl r
+The
+.Fl r
+option permits
+.Nm find
+to execute the utility specified for the
+.Ic exec
+and
+.Ic ok
+primaries from other than the directory where
+.Nm find
+was executed.
+.Nm Find
+may then change directories during the file hierarchy walk, meaning
+that
+.Nm find
+can traverse hierarchies with path names longer than those directly
+resolvable by the kernel.
+This usually results in a performance improvement as well.
-static char sccsid[] = "@(#)function.c 5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)function.c 5.9 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
for (cnt = 0; plan->e_argv[cnt]; ++cnt)
if (plan->e_len[cnt])
find_subst(plan->e_orig[cnt], &plan->e_argv[cnt],
for (cnt = 0; plan->e_argv[cnt]; ++cnt)
if (plan->e_len[cnt])
find_subst(plan->e_orig[cnt], &plan->e_argv[cnt],
- entry->fts_path, plan->e_len[cnt]);
+ entry->fts_accpath, plan->e_len[cnt]);
if (plan->flags && !find_queryuser(plan->e_argv))
return(0);
if (plan->flags && !find_queryuser(plan->e_argv))
return(0);
char ***argvp;
int isok;
{
char ***argvp;
int isok;
{
PLAN *new; /* node returned */
register int cnt;
register char **argv, **ap, *p;
PLAN *new; /* node returned */
register int cnt;
register char **argv, **ap, *p;
- ftsoptions |= FTS_NOCHDIR;
+ if (!relative)
+ ftsoptions |= FTS_NOCHDIR;
output_specified = 1;
NEW(T_EXEC, f_exec);
output_specified = 1;
NEW(T_EXEC, f_exec);
-static char sccsid[] = "@(#)main.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.3 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
#include <fts.h>
#include "find.h"
#include <fts.h>
#include "find.h"
newsyntax(argc, argvp)
int argc;
char ***argvp;
newsyntax(argc, argvp)
int argc;
char ***argvp;
char **argv, **cur;
cur = argv = *argvp;
char **argv, **cur;
cur = argv = *argvp;
- while ((ch = getopt(argc, argv, "df:sx")) != EOF)
+ while ((ch = getopt(argc, argv, "df:rsx")) != EOF)
switch(ch) {
case 'd':
depth = 1;
switch(ch) {
case 'd':
depth = 1;
case 'f':
*cur++ = optarg;
break;
case 'f':
*cur++ = optarg;
break;
+ case 'r':
+ relative = 1;
+ break;
case 's':
ftsoptions &= ~FTS_PHYSICAL;
ftsoptions |= FTS_LOGICAL;
case 's':
ftsoptions &= ~FTS_PHYSICAL;
ftsoptions |= FTS_LOGICAL;
-static char sccsid[] = "@(#)misc.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)misc.c 5.3 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
(void)fprintf(stderr, "usage: find path-list expression\n");
else
(void)fprintf(stderr,
(void)fprintf(stderr, "usage: find path-list expression\n");
else
(void)fprintf(stderr,
- "usage: find [-dsx] -f path ... expression\n");
+ "usage: find [-drsx] -f path ... expression\n");