-/* * $OpenBSD: extern.h,v 1.2 1996/06/26 05:33:07 deraadt Exp $*/
+/* * $OpenBSD: extern.h,v 1.3 1996/08/31 22:40:18 tholo Exp $*/
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
PLAN *c_inum __P((char *));
PLAN *c_links __P((char *));
PLAN *c_ls __P((void));
+PLAN *c_mdepth __P((char *));
PLAN *c_name __P((char *));
PLAN *c_newer __P((char *));
PLAN *c_nogroup __P((void));
-.\" $OpenBSD: find.1,v 1.5 1996/06/26 05:33:08 deraadt Exp $
+.\" $OpenBSD: find.1,v 1.6 1996/08/31 22:40:19 tholo Exp $
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\"
.\" from: @(#)find.1 8.1 (Berkeley) 6/6/93
.\"
-.Dd June 6, 1993
+.Dd August 31, 1996
.Dt FIND 1
.Os
.Sh NAME
If the file is a symbolic link, the pathname of the linked\-to file will be
displayed preceded by ``\->''.
The format is identical to that produced by ``ls \-dgils''.
+.It Ic -maxdepth Ar n
+True if the current search depth is less than what is specified in
+.Ar n .
.It Ic -mtime Ar n
True if the difference between the file last modification time and the time
.Nm find
-/* * $OpenBSD: find.h,v 1.2 1996/06/26 05:33:09 deraadt Exp $*/
+/* * $OpenBSD: find.h,v 1.3 1996/08/31 22:40:20 tholo Exp $*/
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
enum ntype {
N_AND = 1, /* must start > 0 */
N_ATIME, N_CLOSEPAREN, N_CTIME, N_DEPTH, N_EXEC, N_EXPR, N_FOLLOW,
- N_FSTYPE, N_GROUP, N_INUM, N_LINKS, N_LS, N_MTIME, N_NAME, N_NEWER,
- N_NOGROUP, N_NOT, N_NOUSER, N_OK, N_OPENPAREN, N_OR, N_PATH,
+ N_FSTYPE, N_GROUP, N_INUM, N_LINKS, N_LS, N_MDEPTH, N_MTIME, N_NAME,
+ N_NEWER, N_NOGROUP, N_NOT, N_NOUSER, N_OK, N_OPENPAREN, N_OR, N_PATH,
N_PERM, N_PRINT, N_PRINT0, N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV,
};
} ex;
char *_a_data[2]; /* array of char pointers */
char *_c_data; /* char pointer */
+ int _d_data; /* tree depth */
} p_un;
} PLAN;
#define a_data p_un._a_data
#define c_data p_un._c_data
+#define d_data p_un._d_data
#define i_data p_un._i_data
#define g_data p_un._g_data
#define l_data p_un._l_data
-/* $OpenBSD: function.c,v 1.4 1996/06/26 05:33:10 deraadt Exp $ */
+/* $OpenBSD: function.c,v 1.5 1996/08/31 22:40:21 tholo Exp $ */
/*-
* Copyright (c) 1990, 1993
#ifndef lint
/*static char sccsid[] = "from: @(#)function.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: function.c,v 1.4 1996/06/26 05:33:10 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: function.c,v 1.5 1996/08/31 22:40:21 tholo Exp $";
#endif /* not lint */
#include <sys/param.h>
return (palloc(N_LS, f_ls));
}
+/*
+ * - maxdepth n functions --
+ *
+ * True if the current search depth is less than or equal to the
+ * maximum depth specified
+ */
+int
+f_mdepth(plan, entry)
+ PLAN *plan;
+ FTSENT *entry;
+{
+ extern FTS *tree;
+
+ if (entry->fts_level >= plan->d_data)
+ fts_set(tree, entry, FTS_SKIP);
+ return (entry->fts_level <= plan->d_data);
+}
+
+PLAN *
+c_mdepth(arg)
+ char *arg;
+{
+ PLAN *new;
+
+ new = palloc(N_MDEPTH, f_mdepth);
+ new->d_data = atoi(arg);
+ return (new);
+}
+
/*
* -mtime n functions --
*
-/* $OpenBSD: option.c,v 1.2 1996/06/26 05:33:13 deraadt Exp $ */
+/* $OpenBSD: option.c,v 1.3 1996/08/31 22:40:22 tholo Exp $ */
/*-
* Copyright (c) 1990, 1993
#ifndef lint
/*static char sccsid[] = "from: @(#)option.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: option.c,v 1.2 1996/06/26 05:33:13 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: option.c,v 1.3 1996/08/31 22:40:22 tholo Exp $";
#endif /* not lint */
#include <sys/types.h>
{ "-inum", N_INUM, c_inum, O_ARGV },
{ "-links", N_LINKS, c_links, O_ARGV },
{ "-ls", N_LS, c_ls, O_ZERO },
+ { "-maxdepth", N_MDEPTH, c_mdepth, O_ARGV },
{ "-mtime", N_MTIME, c_mtime, O_ARGV },
{ "-name", N_NAME, c_name, O_ARGV },
{ "-newer", N_NEWER, c_newer, O_ARGV },