SCCS-vsn: usr.bin/find/find.c 4.29
SCCS-vsn: usr.bin/find/function.c 5.5
SCCS-vsn: usr.bin/find/main.c 5.2
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)find.c 4.28 (Berkeley) %G%";
+static char sccsid[] = "@(#)find.c 4.29 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
FTS *tree; /* pointer to top of FTS hierarchy */
time_t now; /* time find was run */
FTS *tree; /* pointer to top of FTS hierarchy */
time_t now; /* time find was run */
-dev_t curdev = (dev_t)-1; /* device number of current tree */
int ftsoptions; /* options passed to ftsopen() */
int deprecated; /* old or new syntax */
int depth; /* set by -depth option */
int output_specified; /* one of -print, -ok or -exec was specified */
int ftsoptions; /* options passed to ftsopen() */
int deprecated; /* old or new syntax */
int depth; /* set by -depth option */
int output_specified; /* one of -print, -ok or -exec was specified */
-int xdev; /* set by -xdev option */
main(argc, argv)
int argc;
main(argc, argv)
int argc;
- /* always keep curdev up to date, -fstype uses it. */
- if (xdev && curdev != entry->fts_statb.st_dev &&
- curdev != -1 && ftsset(tree, entry, FTS_SKIP)) {
- (void)fprintf(stderr, "find: %s: %s.\n",
- entry->fts_path, strerror(errno));
- exit(1);
- }
-
/*
* call all the functions in the execution plan until one is
* false or all have been executed. This is where we do all
* the work specified by the user on the command line.
*/
for (p = plan; p && (p->eval)(p, entry); p = p->next);
/*
* call all the functions in the execution plan until one is
* false or all have been executed. This is where we do all
* the work specified by the user on the command line.
*/
for (p = plan; p && (p->eval)(p, entry); p = p->next);
-
- curdev = entry->fts_statb.st_dev;
}
(void)ftsclose(tree);
}
}
(void)ftsclose(tree);
}
-static char sccsid[] = "@(#)function.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)function.c 5.5 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
PLAN *plan;
FTSENT *entry;
{
PLAN *plan;
FTSENT *entry;
{
+ static dev_t curdev; /* need a guaranteed illegal dev value */
+ static int first = 1;
struct statfs sb;
static short val;
/* only check when we cross mount point */
struct statfs sb;
static short val;
/* only check when we cross mount point */
- if (curdev != entry->fts_statb.st_dev) {
+ if (first || curdev != entry->fts_statb.st_dev) {
if (statfs(entry->fts_accpath, &sb)) {
(void)fprintf(stderr, "find: %s: %s.\n",
entry->fts_accpath, strerror(errno));
exit(1);
}
if (statfs(entry->fts_accpath, &sb)) {
(void)fprintf(stderr, "find: %s: %s.\n",
entry->fts_accpath, strerror(errno));
exit(1);
}
val = plan->flags == MOUNT_NONE ? sb.f_flags : sb.f_type;
}
return(plan->flags == MOUNT_NONE ?
val = plan->flags == MOUNT_NONE ? sb.f_flags : sb.f_type;
}
return(plan->flags == MOUNT_NONE ?
*
* Always true, causes find not to decend past directories that have a
* different device ID (st_dev, see stat() S5.6.2 [POSIX.1])
*
* Always true, causes find not to decend past directories that have a
* different device ID (st_dev, see stat() S5.6.2 [POSIX.1])
- *
- * Note: this checking is done in find_execute().
ftsoptions &= ~FTS_NOSTAT;
ftsoptions &= ~FTS_NOSTAT;
+ ftsoptions |= FTS_XDEV;
NEW(T_XDEV, f_always_true);
return(new);
NEW(T_XDEV, f_always_true);
return(new);
-static char sccsid[] = "@(#)main.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
char ***argvp;
{
extern char *optarg;
char ***argvp;
{
extern char *optarg;
- extern int depth, optind, xdev;
+ extern int depth, optind;
int ch;
char **argv, **cur;
int ch;
char **argv, **cur;
ftsoptions |= FTS_LOGICAL;
break;
case 'x':
ftsoptions |= FTS_LOGICAL;
break;
case 'x':
ftsoptions &= ~FTS_NOSTAT;
ftsoptions &= ~FTS_NOSTAT;
+ ftsoptions |= FTS_XDEV;
break;
case '?':
default:
break;
case '?':
default: