tydy up a few uses of recursive_action(), no logic changes
No binary (build failed)
—
(log yok)
| @@ -133,10 +133,10 @@ static int bb_alphasort(const void *p1, const void *p2) | |
| static int FAST_FUNC act(const char *file, struct stat *statbuf, void *args UNUSED_PARAM, int depth) | |
| { | |
| - | if (depth == 1) |
| + | if (depth == 0) |
| return TRUE; | |
| - | if (depth == 2 |
| + | if (depth == 1 |
| && ( !(statbuf->st_mode & (S_IFREG | S_IFLNK)) | |
| || invalid_name(file) | |
| || (!(option_mask32 & OPT_l) && access(file, X_OK) != 0)) | |
| @@ -200,8 +200,8 @@ int run_parts_main(int argc UNUSED_PARAM, char **argv) | |
| act, /* file action */ | |
| act, /* dir action */ | |
| NULL, /* user data */ | |
| - | 1 /* depth */ |
| - | ); |
| + | 0 /* depth */ |
| + | ); |
| if (!names) | |
| return 0; | |
| @@ -694,15 +694,16 @@ static int FAST_FUNC file_action_grep(const char *filename, | |
| static int grep_dir(const char *dir) | |
| { | |
| int matched = 0; | |
| - | recursive_action(dir, |
| - | /* recurse=yes */ ACTION_RECURSE | |
| - | /* followLinks=always */ ((option_mask32 & OPT_R) ? ACTION_FOLLOWLINKS : 0) | |
| - | /* followLinks=command line only */ ACTION_FOLLOWLINKS_L0 | |
| - | /* depthFirst=yes */ ACTION_DEPTHFIRST, |
| + | recursive_action(dir, 0 |
| + | | ACTION_RECURSE |
| + | | ((option_mask32 & OPT_R) ? ACTION_FOLLOWLINKS : 0) |
| + | | ACTION_FOLLOWLINKS_L0 /* grep -r ... SYMLINK follows it */ |
| + | | ACTION_DEPTHFIRST |
| + | | 0, |
| /* fileAction= */ file_action_grep, | |
| /* dirAction= */ NULL, | |
| /* userData= */ &matched, | |
| - | /* depth= */ 0); |
| + | 0); |
| return matched; | |
| } | |
| @@ -437,15 +437,15 @@ enum { | |
| ACTION_FOLLOWLINKS = (1 << 1), | |
| ACTION_FOLLOWLINKS_L0 = (1 << 2), | |
| ACTION_DEPTHFIRST = (1 << 3), | |
| - | /*ACTION_REVERSE = (1 << 4), - unused */ |
| - | ACTION_QUIET = (1 << 5), |
| - | ACTION_DANGLING_OK = (1 << 6), |
| + | ACTION_QUIET = (1 << 4), |
| + | ACTION_DANGLING_OK = (1 << 5), |
| }; | |
| typedef uint8_t recurse_flags_t; | |
| extern int recursive_action(const char *fileName, unsigned flags, | |
| int FAST_FUNC (*fileAction)(const char *fileName, struct stat* statbuf, void* userData, int depth), | |
| int FAST_FUNC (*dirAction)(const char *fileName, struct stat* statbuf, void* userData, int depth), | |
| void* userData, unsigned depth) FAST_FUNC; | |
| + | |
| extern int device_open(const char *device, int mode) FAST_FUNC; | |
| enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */ | |
| extern int xgetpty(char *line) FAST_FUNC; | |