From 8c35d65c43216bb840326ac7476a180e2ae36fe9 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 27 Oct 2006 23:42:25 +0000 Subject: recursive_action: add depth param chmod: match coreutils versus following links --- findutils/find.c | 6 +++--- findutils/grep.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'findutils') diff --git a/findutils/find.c b/findutils/find.c index 62cb5d7eb..8618f3a97 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -56,7 +56,7 @@ static int num_matches; static int exec_opt; #endif -static int fileAction(const char *fileName, struct stat *statbuf, void* junk) +static int fileAction(const char *fileName, struct stat *statbuf, void* junk, int depth) { #ifdef CONFIG_FEATURE_FIND_XDEV if (S_ISDIR(statbuf->st_mode) && xdev_count) { @@ -307,12 +307,12 @@ int find_main(int argc, char **argv) if (firstopt == 1) { if (!recursive_action(".", TRUE, dereference, FALSE, fileAction, - fileAction, NULL)) + fileAction, NULL, 0)) status = EXIT_FAILURE; } else { for (i = 1; i < firstopt; i++) { if (!recursive_action(argv[i], TRUE, dereference, FALSE, fileAction, - fileAction, NULL)) + fileAction, NULL, 0)) status = EXIT_FAILURE; } } diff --git a/findutils/grep.c b/findutils/grep.c index b76a17a41..8bb38f95c 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -290,7 +290,7 @@ static void load_regexes_from_file(llist_t *fopt) } -static int file_action_grep(const char *filename, struct stat *statbuf, void* matched) +static int file_action_grep(const char *filename, struct stat *statbuf, void* matched, int depth) { FILE *file = fopen(filename, "r"); if (file == NULL) { @@ -315,7 +315,8 @@ static int grep_dir(const char *dir) /* depthFirst= */ 1, /* fileAction= */ file_action_grep, /* dirAction= */ NULL, - /* userData= */ &matched); + /* userData= */ &matched, + /* depth= */ 0); return matched; } -- cgit v1.2.3