diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-08 10:52:28 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-08 10:52:28 +0000 |
commit | bbd695d8010ab453a5a89ba6d7ebfe1a96b87b7d (patch) | |
tree | 98df39594da2e7f1fbe560aec04eeb09426947f0 /libbb/recursive_action.c | |
parent | ca3484103e6b99d0c433988f2f809840d780d88b (diff) | |
download | busybox-w32-bbd695d8010ab453a5a89ba6d7ebfe1a96b87b7d.tar.gz busybox-w32-bbd695d8010ab453a5a89ba6d7ebfe1a96b87b7d.tar.bz2 busybox-w32-bbd695d8010ab453a5a89ba6d7ebfe1a96b87b7d.zip |
find: fix handling of -prune
recursive_actions: uppercase flag constants
Diffstat (limited to 'libbb/recursive_action.c')
-rw-r--r-- | libbb/recursive_action.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c index 0c0531575..be2a700f5 100644 --- a/libbb/recursive_action.c +++ b/libbb/recursive_action.c | |||
@@ -55,12 +55,12 @@ int recursive_action(const char *fileName, | |||
55 | 55 | ||
56 | if (!fileAction) fileAction = true_action; | 56 | if (!fileAction) fileAction = true_action; |
57 | if (!dirAction) dirAction = true_action; | 57 | if (!dirAction) dirAction = true_action; |
58 | status = (flags & action_followLinks ? stat : lstat)(fileName, &statbuf); | 58 | status = (flags & ACTION_FOLLOWLINKS ? stat : lstat)(fileName, &statbuf); |
59 | 59 | ||
60 | if (status < 0) { | 60 | if (status < 0) { |
61 | #ifdef DEBUG_RECURS_ACTION | 61 | #ifdef DEBUG_RECURS_ACTION |
62 | bb_error_msg("status=%d followLinks=%d TRUE=%d", | 62 | bb_error_msg("status=%d followLinks=%d TRUE=%d", |
63 | status, flags & action_followLinks, TRUE); | 63 | status, flags & ACTION_FOLLOWLINKS, TRUE); |
64 | #endif | 64 | #endif |
65 | goto done_nak_warn; | 65 | goto done_nak_warn; |
66 | } | 66 | } |
@@ -68,7 +68,7 @@ int recursive_action(const char *fileName, | |||
68 | /* If S_ISLNK(m), then we know that !S_ISDIR(m). | 68 | /* If S_ISLNK(m), then we know that !S_ISDIR(m). |
69 | * Then we can skip checking first part: if it is true, then | 69 | * Then we can skip checking first part: if it is true, then |
70 | * (!dir) is also true! */ | 70 | * (!dir) is also true! */ |
71 | if ( /* (!(flags & action_followLinks) && S_ISLNK(statbuf.st_mode)) || */ | 71 | if ( /* (!(flags & ACTION_FOLLOWLINKS) && S_ISLNK(statbuf.st_mode)) || */ |
72 | !S_ISDIR(statbuf.st_mode) | 72 | !S_ISDIR(statbuf.st_mode) |
73 | ) { | 73 | ) { |
74 | return fileAction(fileName, &statbuf, userData, depth); | 74 | return fileAction(fileName, &statbuf, userData, depth); |
@@ -76,11 +76,11 @@ int recursive_action(const char *fileName, | |||
76 | 76 | ||
77 | /* It's a directory (or a link to one, and followLinks is set) */ | 77 | /* It's a directory (or a link to one, and followLinks is set) */ |
78 | 78 | ||
79 | if (!(flags & action_recurse)) { | 79 | if (!(flags & ACTION_RECURSE)) { |
80 | return dirAction(fileName, &statbuf, userData, depth); | 80 | return dirAction(fileName, &statbuf, userData, depth); |
81 | } | 81 | } |
82 | 82 | ||
83 | if (!(flags & action_depthFirst)) { | 83 | if (!(flags & ACTION_DEPTHFIRST)) { |
84 | status = dirAction(fileName, &statbuf, userData, depth); | 84 | status = dirAction(fileName, &statbuf, userData, depth); |
85 | if (!status) { | 85 | if (!status) { |
86 | goto done_nak_warn; | 86 | goto done_nak_warn; |
@@ -104,14 +104,14 @@ int recursive_action(const char *fileName, | |||
104 | if (nextFile == NULL) | 104 | if (nextFile == NULL) |
105 | continue; | 105 | continue; |
106 | /* now descend into it, forcing recursion. */ | 106 | /* now descend into it, forcing recursion. */ |
107 | if (!recursive_action(nextFile, flags | action_recurse, | 107 | if (!recursive_action(nextFile, flags | ACTION_RECURSE, |
108 | fileAction, dirAction, userData, depth+1)) { | 108 | fileAction, dirAction, userData, depth+1)) { |
109 | status = FALSE; | 109 | status = FALSE; |
110 | } | 110 | } |
111 | free(nextFile); | 111 | free(nextFile); |
112 | } | 112 | } |
113 | closedir(dir); | 113 | closedir(dir); |
114 | if (flags & action_depthFirst && | 114 | if ((flags & ACTION_DEPTHFIRST) && |
115 | !dirAction(fileName, &statbuf, userData, depth)) { | 115 | !dirAction(fileName, &statbuf, userData, depth)) { |
116 | goto done_nak_warn; | 116 | goto done_nak_warn; |
117 | } | 117 | } |