tydy up a few uses of recursive_action(), no logic changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
4a0eb0370c
commit
3c3928fc65
@ -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)
|
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;
|
return TRUE;
|
||||||
|
|
||||||
if (depth == 2
|
if (depth == 1
|
||||||
&& ( !(statbuf->st_mode & (S_IFREG | S_IFLNK))
|
&& ( !(statbuf->st_mode & (S_IFREG | S_IFLNK))
|
||||||
|| invalid_name(file)
|
|| invalid_name(file)
|
||||||
|| (!(option_mask32 & OPT_l) && access(file, X_OK) != 0))
|
|| (!(option_mask32 & OPT_l) && access(file, X_OK) != 0))
|
||||||
@ -200,7 +200,7 @@ int run_parts_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
act, /* file action */
|
act, /* file action */
|
||||||
act, /* dir action */
|
act, /* dir action */
|
||||||
NULL, /* user data */
|
NULL, /* user data */
|
||||||
1 /* depth */
|
0 /* depth */
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!names)
|
if (!names)
|
||||||
|
@ -694,15 +694,16 @@ static int FAST_FUNC file_action_grep(const char *filename,
|
|||||||
static int grep_dir(const char *dir)
|
static int grep_dir(const char *dir)
|
||||||
{
|
{
|
||||||
int matched = 0;
|
int matched = 0;
|
||||||
recursive_action(dir,
|
recursive_action(dir, 0
|
||||||
/* recurse=yes */ ACTION_RECURSE |
|
| ACTION_RECURSE
|
||||||
/* followLinks=always */ ((option_mask32 & OPT_R) ? ACTION_FOLLOWLINKS : 0) |
|
| ((option_mask32 & OPT_R) ? ACTION_FOLLOWLINKS : 0)
|
||||||
/* followLinks=command line only */ ACTION_FOLLOWLINKS_L0 |
|
| ACTION_FOLLOWLINKS_L0 /* grep -r ... SYMLINK follows it */
|
||||||
/* depthFirst=yes */ ACTION_DEPTHFIRST,
|
| ACTION_DEPTHFIRST
|
||||||
|
| 0,
|
||||||
/* fileAction= */ file_action_grep,
|
/* fileAction= */ file_action_grep,
|
||||||
/* dirAction= */ NULL,
|
/* dirAction= */ NULL,
|
||||||
/* userData= */ &matched,
|
/* userData= */ &matched,
|
||||||
/* depth= */ 0);
|
0);
|
||||||
return matched;
|
return matched;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,15 +437,15 @@ enum {
|
|||||||
ACTION_FOLLOWLINKS = (1 << 1),
|
ACTION_FOLLOWLINKS = (1 << 1),
|
||||||
ACTION_FOLLOWLINKS_L0 = (1 << 2),
|
ACTION_FOLLOWLINKS_L0 = (1 << 2),
|
||||||
ACTION_DEPTHFIRST = (1 << 3),
|
ACTION_DEPTHFIRST = (1 << 3),
|
||||||
/*ACTION_REVERSE = (1 << 4), - unused */
|
ACTION_QUIET = (1 << 4),
|
||||||
ACTION_QUIET = (1 << 5),
|
ACTION_DANGLING_OK = (1 << 5),
|
||||||
ACTION_DANGLING_OK = (1 << 6),
|
|
||||||
};
|
};
|
||||||
typedef uint8_t recurse_flags_t;
|
typedef uint8_t recurse_flags_t;
|
||||||
extern int recursive_action(const char *fileName, unsigned flags,
|
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 (*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),
|
int FAST_FUNC (*dirAction)(const char *fileName, struct stat* statbuf, void* userData, int depth),
|
||||||
void* userData, unsigned depth) FAST_FUNC;
|
void* userData, unsigned depth) FAST_FUNC;
|
||||||
|
|
||||||
extern int device_open(const char *device, int mode) FAST_FUNC;
|
extern int device_open(const char *device, int mode) FAST_FUNC;
|
||||||
enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */
|
enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */
|
||||||
extern int xgetpty(char *line) FAST_FUNC;
|
extern int xgetpty(char *line) FAST_FUNC;
|
||||||
|
Loading…
Reference in New Issue
Block a user