diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-09-01 04:30:18 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-09-01 04:30:18 +0000 |
commit | 8dad430db90288ee99638aaf3f18fb518bba269c (patch) | |
tree | d088b5867f5ddf5598930427c41ed880f59f3ae2 /usr.bin/find/function.c | |
parent | 10a0f9a6e2e02a8c66e4031ad1b040cd89267df7 (diff) |
Add support for -mindepth while at it
Diffstat (limited to 'usr.bin/find/function.c')
-rw-r--r-- | usr.bin/find/function.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c index 707a925b24c..42a4506d022 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -1,4 +1,4 @@ -/* $OpenBSD: function.c,v 1.5 1996/08/31 22:40:21 tholo Exp $ */ +/* $OpenBSD: function.c,v 1.6 1996/09/01 04:30:17 tholo Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -38,7 +38,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)function.c 8.1 (Berkeley) 6/6/93";*/ -static char rcsid[] = "$OpenBSD: function.c,v 1.5 1996/08/31 22:40:21 tholo Exp $"; +static char rcsid[] = "$OpenBSD: function.c,v 1.6 1996/09/01 04:30:17 tholo Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -550,25 +550,52 @@ c_ls() * maximum depth specified */ int -f_mdepth(plan, entry) +f_maxdepth(plan, entry) PLAN *plan; FTSENT *entry; { extern FTS *tree; - if (entry->fts_level >= plan->d_data) + if (entry->fts_level >= plan->max_data) fts_set(tree, entry, FTS_SKIP); - return (entry->fts_level <= plan->d_data); + return (entry->fts_level <= plan->max_data); } PLAN * -c_mdepth(arg) +c_maxdepth(arg) char *arg; { PLAN *new; - new = palloc(N_MDEPTH, f_mdepth); - new->d_data = atoi(arg); + new = palloc(N_MAXDEPTH, f_maxdepth); + new->max_data = atoi(arg); + return (new); +} + +/* + * - mindepth n functions -- + * + * True if the current search depth is greater than or equal to the + * minimum depth specified + */ +int +f_mindepth(plan, entry) + PLAN *plan; + FTSENT *entry; +{ + extern FTS *tree; + + return (entry->fts_level >= plan->min_data); +} + +PLAN * +c_mindepth(arg) + char *arg; +{ + PLAN *new; + + new = palloc(N_MINDEPTH, f_mindepth); + new->min_data = atoi(arg); return (new); } |