summaryrefslogtreecommitdiffstats
path: root/usr.bin/find/find.c
diff options
context:
space:
mode:
authoreik <eik@FreeBSD.org>2004-05-28 17:17:15 +0000
committereik <eik@FreeBSD.org>2004-05-28 17:17:15 +0000
commit67b0af2d89cbb9ad02ca489ff6320ffe6bf878d5 (patch)
treede2701bbe39f57e4860326018916a82714254cdb /usr.bin/find/find.c
parent577b8571b9834b90908480fd24b3383ed54f7b4c (diff)
downloadFreeBSD-src-67b0af2d89cbb9ad02ca489ff6320ffe6bf878d5.zip
FreeBSD-src-67b0af2d89cbb9ad02ca489ff6320ffe6bf878d5.tar.gz
- introduce a new primary `-depth n', which tests whether
the depth of the current file relative to the starting point of the traversal is n. The usual +/- modifiers to the argument apply. - while I'm here, fix -maxdepth in the case of a depth-first traversal Print the top ten maintainers of python module ports (works with p5-* too): find /usr/ports -depth 2 \! -name 'py-*' -prune -o \ -depth 3 -name Makefile -execdir make -VMAINTAINER \; \ | sort | uniq -c | sort -nr | head PR: 66667 Reviewed by: ru, joerg Approved by: joerg MFC after: 2 weeks
Diffstat (limited to 'usr.bin/find/find.c')
-rw-r--r--usr.bin/find/find.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c
index 4b3d2df..0486e8b 100644
--- a/usr.bin/find/find.c
+++ b/usr.bin/find/find.c
@@ -186,6 +186,11 @@ find_execute(PLAN *plan, char *paths[])
err(1, "ftsopen");
for (rval = 0; (entry = fts_read(tree)) != NULL;) {
+ if (maxdepth != -1 && entry->fts_level >= maxdepth) {
+ if (fts_set(tree, entry, FTS_SKIP))
+ err(1, "%s", entry->fts_path);
+ }
+
switch (entry->fts_info) {
case FTS_D:
if (isdepth)
@@ -225,12 +230,6 @@ find_execute(PLAN *plan, char *paths[])
* the work specified by the user on the command line.
*/
for (p = plan; p && (p->execute)(p, entry); p = p->next);
-
- if (maxdepth != -1 && entry->fts_level >= maxdepth) {
- if (fts_set(tree, entry, FTS_SKIP))
- err(1, "%s", entry->fts_path);
- continue;
- }
}
/* Finish any pending -exec ... {} + functions. */
for (p = plan; p != NULL; p = p->next)
OpenPOWER on IntegriCloud