diff options
author | Denis Vlasenko | 2009-04-21 11:09:40 +0000 |
---|---|---|
committer | Denis Vlasenko | 2009-04-21 11:09:40 +0000 |
commit | 5e34ff29bcc870936ab18172f438a34d042d4e03 (patch) | |
tree | a5e7a528f2f916eb883f1161eadceacdf2dca4be /findutils | |
parent | 8b814b4a349e2262c0ad25793b05206a14651ebb (diff) | |
download | busybox-5e34ff29bcc870936ab18172f438a34d042d4e03.zip busybox-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.gz |
*: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
Diffstat (limited to 'findutils')
-rw-r--r-- | findutils/find.c | 150 | ||||
-rw-r--r-- | findutils/grep.c | 38 | ||||
-rw-r--r-- | findutils/xargs.c | 20 |
3 files changed, 104 insertions, 104 deletions
diff --git a/findutils/find.c b/findutils/find.c index df632f2..da024af 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -62,8 +62,8 @@ /* This is a NOEXEC applet. Be very careful! */ -USE_FEATURE_FIND_XDEV(static dev_t *xdev_dev;) -USE_FEATURE_FIND_XDEV(static int xdev_count;) +IF_FEATURE_FIND_XDEV(static dev_t *xdev_dev;) +IF_FEATURE_FIND_XDEV(static int xdev_count;) typedef int (*action_fp)(const char *fileName, struct stat *statbuf, void *); @@ -79,23 +79,23 @@ typedef struct { action_##name* ap UNUSED_PARAM) ACTS(print) ACTS(name, const char *pattern; bool iname;) -USE_FEATURE_FIND_PATH( ACTS(path, const char *pattern;)) -USE_FEATURE_FIND_REGEX( ACTS(regex, regex_t compiled_pattern;)) -USE_FEATURE_FIND_PRINT0( ACTS(print0)) -USE_FEATURE_FIND_TYPE( ACTS(type, int type_mask;)) -USE_FEATURE_FIND_PERM( ACTS(perm, char perm_char; mode_t perm_mask;)) -USE_FEATURE_FIND_MTIME( ACTS(mtime, char mtime_char; unsigned mtime_days;)) -USE_FEATURE_FIND_MMIN( ACTS(mmin, char mmin_char; unsigned mmin_mins;)) -USE_FEATURE_FIND_NEWER( ACTS(newer, time_t newer_mtime;)) -USE_FEATURE_FIND_INUM( ACTS(inum, ino_t inode_num;)) -USE_FEATURE_FIND_USER( ACTS(user, uid_t uid;)) -USE_FEATURE_FIND_SIZE( ACTS(size, char size_char; off_t size;)) -USE_FEATURE_FIND_CONTEXT(ACTS(context, security_context_t context;)) -USE_FEATURE_FIND_PAREN( ACTS(paren, action ***subexpr;)) -USE_FEATURE_FIND_PRUNE( ACTS(prune)) -USE_FEATURE_FIND_DELETE( ACTS(delete)) -USE_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; unsigned *subst_count; int exec_argc;)) -USE_FEATURE_FIND_GROUP( ACTS(group, gid_t gid;)) +IF_FEATURE_FIND_PATH( ACTS(path, const char *pattern;)) +IF_FEATURE_FIND_REGEX( ACTS(regex, regex_t compiled_pattern;)) +IF_FEATURE_FIND_PRINT0( ACTS(print0)) +IF_FEATURE_FIND_TYPE( ACTS(type, int type_mask;)) +IF_FEATURE_FIND_PERM( ACTS(perm, char perm_char; mode_t perm_mask;)) +IF_FEATURE_FIND_MTIME( ACTS(mtime, char mtime_char; unsigned mtime_days;)) +IF_FEATURE_FIND_MMIN( ACTS(mmin, char mmin_char; unsigned mmin_mins;)) +IF_FEATURE_FIND_NEWER( ACTS(newer, time_t newer_mtime;)) +IF_FEATURE_FIND_INUM( ACTS(inum, ino_t inode_num;)) +IF_FEATURE_FIND_USER( ACTS(user, uid_t uid;)) +IF_FEATURE_FIND_SIZE( ACTS(size, char size_char; off_t size;)) +IF_FEATURE_FIND_CONTEXT(ACTS(context, security_context_t context;)) +IF_FEATURE_FIND_PAREN( ACTS(paren, action ***subexpr;)) +IF_FEATURE_FIND_PRUNE( ACTS(prune)) +IF_FEATURE_FIND_DELETE( ACTS(delete)) +IF_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; unsigned *subst_count; int exec_argc;)) +IF_FEATURE_FIND_GROUP( ACTS(group, gid_t gid;)) static action ***actions; static bool need_print = 1; @@ -376,8 +376,8 @@ ACTF(context) static int FAST_FUNC fileAction(const char *fileName, struct stat *statbuf, - void *userData SKIP_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM), - int depth SKIP_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM)) + void *userData IF_NOT_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM), + int depth IF_NOT_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM)) { int i; #if ENABLE_FEATURE_FIND_MAXDEPTH @@ -451,73 +451,73 @@ static action*** parse_params(char **argv) enum { PARM_a , PARM_o , - USE_FEATURE_FIND_NOT( PARM_char_not ,) + IF_FEATURE_FIND_NOT( PARM_char_not ,) #if ENABLE_DESKTOP PARM_and , PARM_or , - USE_FEATURE_FIND_NOT( PARM_not ,) + IF_FEATURE_FIND_NOT( PARM_not ,) #endif PARM_print , - USE_FEATURE_FIND_PRINT0( PARM_print0 ,) - USE_FEATURE_FIND_DEPTH( PARM_depth ,) - USE_FEATURE_FIND_PRUNE( PARM_prune ,) - USE_FEATURE_FIND_DELETE( PARM_delete ,) - USE_FEATURE_FIND_EXEC( PARM_exec ,) - USE_FEATURE_FIND_PAREN( PARM_char_brace,) + IF_FEATURE_FIND_PRINT0( PARM_print0 ,) + IF_FEATURE_FIND_DEPTH( PARM_depth ,) + IF_FEATURE_FIND_PRUNE( PARM_prune ,) + IF_FEATURE_FIND_DELETE( PARM_delete ,) + IF_FEATURE_FIND_EXEC( PARM_exec ,) + IF_FEATURE_FIND_PAREN( PARM_char_brace,) /* All options starting from here require argument */ PARM_name , PARM_iname , - USE_FEATURE_FIND_PATH( PARM_path ,) - USE_FEATURE_FIND_REGEX( PARM_regex ,) - USE_FEATURE_FIND_TYPE( PARM_type ,) - USE_FEATURE_FIND_PERM( PARM_perm ,) - USE_FEATURE_FIND_MTIME( PARM_mtime ,) - USE_FEATURE_FIND_MMIN( PARM_mmin ,) - USE_FEATURE_FIND_NEWER( PARM_newer ,) - USE_FEATURE_FIND_INUM( PARM_inum ,) - USE_FEATURE_FIND_USER( PARM_user ,) - USE_FEATURE_FIND_GROUP( PARM_group ,) - USE_FEATURE_FIND_SIZE( PARM_size ,) - USE_FEATURE_FIND_CONTEXT(PARM_context ,) + IF_FEATURE_FIND_PATH( PARM_path ,) + IF_FEATURE_FIND_REGEX( PARM_regex ,) + IF_FEATURE_FIND_TYPE( PARM_type ,) + IF_FEATURE_FIND_PERM( PARM_perm ,) + IF_FEATURE_FIND_MTIME( PARM_mtime ,) + IF_FEATURE_FIND_MMIN( PARM_mmin ,) + IF_FEATURE_FIND_NEWER( PARM_newer ,) + IF_FEATURE_FIND_INUM( PARM_inum ,) + IF_FEATURE_FIND_USER( PARM_user ,) + IF_FEATURE_FIND_GROUP( PARM_group ,) + IF_FEATURE_FIND_SIZE( PARM_size ,) + IF_FEATURE_FIND_CONTEXT(PARM_context ,) }; static const char params[] ALIGN1 = "-a\0" "-o\0" - USE_FEATURE_FIND_NOT( "!\0" ) + IF_FEATURE_FIND_NOT( "!\0" ) #if ENABLE_DESKTOP "-and\0" "-or\0" - USE_FEATURE_FIND_NOT( "-not\0" ) + IF_FEATURE_FIND_NOT( "-not\0" ) #endif "-print\0" - USE_FEATURE_FIND_PRINT0( "-print0\0" ) - USE_FEATURE_FIND_DEPTH( "-depth\0" ) - USE_FEATURE_FIND_PRUNE( "-prune\0" ) - USE_FEATURE_FIND_DELETE( "-delete\0" ) - USE_FEATURE_FIND_EXEC( "-exec\0" ) - USE_FEATURE_FIND_PAREN( "(\0" ) + IF_FEATURE_FIND_PRINT0( "-print0\0" ) + IF_FEATURE_FIND_DEPTH( "-depth\0" ) + IF_FEATURE_FIND_PRUNE( "-prune\0" ) + IF_FEATURE_FIND_DELETE( "-delete\0" ) + IF_FEATURE_FIND_EXEC( "-exec\0" ) + IF_FEATURE_FIND_PAREN( "(\0" ) /* All options starting from here require argument */ "-name\0" "-iname\0" - USE_FEATURE_FIND_PATH( "-path\0" ) - USE_FEATURE_FIND_REGEX( "-regex\0" ) - USE_FEATURE_FIND_TYPE( "-type\0" ) - USE_FEATURE_FIND_PERM( "-perm\0" ) - USE_FEATURE_FIND_MTIME( "-mtime\0" ) - USE_FEATURE_FIND_MMIN( "-mmin\0" ) - USE_FEATURE_FIND_NEWER( "-newer\0" ) - USE_FEATURE_FIND_INUM( "-inum\0" ) - USE_FEATURE_FIND_USER( "-user\0" ) - USE_FEATURE_FIND_GROUP( "-group\0" ) - USE_FEATURE_FIND_SIZE( "-size\0" ) - USE_FEATURE_FIND_CONTEXT("-context\0") + IF_FEATURE_FIND_PATH( "-path\0" ) + IF_FEATURE_FIND_REGEX( "-regex\0" ) + IF_FEATURE_FIND_TYPE( "-type\0" ) + IF_FEATURE_FIND_PERM( "-perm\0" ) + IF_FEATURE_FIND_MTIME( "-mtime\0" ) + IF_FEATURE_FIND_MMIN( "-mmin\0" ) + IF_FEATURE_FIND_NEWER( "-newer\0" ) + IF_FEATURE_FIND_INUM( "-inum\0" ) + IF_FEATURE_FIND_USER( "-user\0" ) + IF_FEATURE_FIND_GROUP( "-group\0" ) + IF_FEATURE_FIND_SIZE( "-size\0" ) + IF_FEATURE_FIND_CONTEXT("-context\0") ; action*** appp; unsigned cur_group = 0; unsigned cur_action = 0; - USE_FEATURE_FIND_NOT( bool invert_flag = 0; ) + IF_FEATURE_FIND_NOT( bool invert_flag = 0; ) /* This is the only place in busybox where we use nested function. * So far more standard alternatives were bigger. */ @@ -530,8 +530,8 @@ static action*** parse_params(char **argv) appp[cur_group][cur_action++] = ap = xmalloc(sizeof_struct); appp[cur_group][cur_action] = NULL; ap->f = f; - USE_FEATURE_FIND_NOT( ap->invert = invert_flag; ) - USE_FEATURE_FIND_NOT( invert_flag = 0; ) + IF_FEATURE_FIND_NOT( ap->invert = invert_flag; ) + IF_FEATURE_FIND_NOT( invert_flag = 0; ) return ap; } @@ -569,10 +569,10 @@ static action*** parse_params(char **argv) * it doesn't give smaller code. Other arches? */ /* --- Operators --- */ - if (parm == PARM_a USE_DESKTOP(|| parm == PARM_and)) { + if (parm == PARM_a IF_DESKTOP(|| parm == PARM_and)) { /* no further special handling required */ } - else if (parm == PARM_o USE_DESKTOP(|| parm == PARM_or)) { + else if (parm == PARM_o IF_DESKTOP(|| parm == PARM_or)) { /* start new OR group */ cur_group++; appp = xrealloc(appp, (cur_group+2) * sizeof(*appp)); @@ -581,7 +581,7 @@ static action*** parse_params(char **argv) cur_action = 0; } #if ENABLE_FEATURE_FIND_NOT - else if (parm == PARM_char_not USE_DESKTOP(|| parm == PARM_not)) { + else if (parm == PARM_char_not IF_DESKTOP(|| parm == PARM_not)) { /* also handles "find ! ! -name 'foo*'" */ invert_flag ^= 1; } @@ -591,13 +591,13 @@ static action*** parse_params(char **argv) else if (parm == PARM_print) { need_print = 0; /* GNU find ignores '!' here: "find ! -print" */ - USE_FEATURE_FIND_NOT( invert_flag = 0; ) + IF_FEATURE_FIND_NOT( invert_flag = 0; ) (void) ALLOC_ACTION(print); } #if ENABLE_FEATURE_FIND_PRINT0 else if (parm == PARM_print0) { need_print = 0; - USE_FEATURE_FIND_NOT( invert_flag = 0; ) + IF_FEATURE_FIND_NOT( invert_flag = 0; ) (void) ALLOC_ACTION(print0); } #endif @@ -608,7 +608,7 @@ static action*** parse_params(char **argv) #endif #if ENABLE_FEATURE_FIND_PRUNE else if (parm == PARM_prune) { - USE_FEATURE_FIND_NOT( invert_flag = 0; ) + IF_FEATURE_FIND_NOT( invert_flag = 0; ) (void) ALLOC_ACTION(prune); } #endif @@ -624,7 +624,7 @@ static action*** parse_params(char **argv) int i; action_exec *ap; need_print = 0; - USE_FEATURE_FIND_NOT( invert_flag = 0; ) + IF_FEATURE_FIND_NOT( invert_flag = 0; ) ap = ALLOC_ACTION(exec); ap->exec_argv = ++argv; /* first arg after -exec */ ap->exec_argc = 0; @@ -813,13 +813,13 @@ int find_main(int argc, char **argv) { static const char options[] ALIGN1 = "-follow\0" -USE_FEATURE_FIND_XDEV( "-xdev\0" ) -USE_FEATURE_FIND_MAXDEPTH("-mindepth\0""-maxdepth\0") +IF_FEATURE_FIND_XDEV( "-xdev\0" ) +IF_FEATURE_FIND_MAXDEPTH("-mindepth\0""-maxdepth\0") ; enum { OPT_FOLLOW, -USE_FEATURE_FIND_XDEV( OPT_XDEV ,) -USE_FEATURE_FIND_MAXDEPTH(OPT_MINDEPTH,) +IF_FEATURE_FIND_XDEV( OPT_XDEV ,) +IF_FEATURE_FIND_MAXDEPTH(OPT_MINDEPTH,) }; char *arg; diff --git a/findutils/grep.c b/findutils/grep.c index e23f9bc..774f04d 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -25,10 +25,10 @@ /* options */ #define OPTSTR_GREP \ "lnqvscFiHhe:f:Lorm:" \ - USE_FEATURE_GREP_CONTEXT("A:B:C:") \ - USE_FEATURE_GREP_EGREP_ALIAS("E") \ - USE_DESKTOP("w") \ - USE_EXTRA_COMPAT("z") \ + IF_FEATURE_GREP_CONTEXT("A:B:C:") \ + IF_FEATURE_GREP_EGREP_ALIAS("E") \ + IF_DESKTOP("w") \ + IF_EXTRA_COMPAT("z") \ "aI" /* ignored: -a "assume all files to be text" */ @@ -51,12 +51,12 @@ enum { OPTBIT_o, /* show only matching parts of lines */ OPTBIT_r, /* recurse dirs */ OPTBIT_m, /* -m MAX_MATCHES */ - USE_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */ - USE_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */ - USE_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */ - USE_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */ - USE_DESKTOP( OPTBIT_w ,) /* whole word match */ - USE_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */ + IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */ + IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */ + IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */ + IF_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */ + IF_DESKTOP( OPTBIT_w ,) /* whole word match */ + IF_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */ OPT_l = 1 << OPTBIT_l, OPT_n = 1 << OPTBIT_n, OPT_q = 1 << OPTBIT_q, @@ -73,12 +73,12 @@ enum { OPT_o = 1 << OPTBIT_o, OPT_r = 1 << OPTBIT_r, OPT_m = 1 << OPTBIT_m, - OPT_A = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0, - OPT_B = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0, - OPT_C = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0, - OPT_E = USE_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0, - OPT_w = USE_DESKTOP( (1 << OPTBIT_w)) + 0, - OPT_z = USE_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0, + OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0, + OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0, + OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0, + OPT_E = IF_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0, + OPT_w = IF_DESKTOP( (1 << OPTBIT_w)) + 0, + OPT_z = IF_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0, }; #define PRINT_FILES_WITH_MATCHES (option_mask32 & OPT_l) @@ -105,7 +105,7 @@ struct globals { int lines_before; int lines_after; char **before_buf; - USE_EXTRA_COMPAT(size_t *before_buf_size;) + IF_EXTRA_COMPAT(size_t *before_buf_size;) int last_line_printed; #endif /* globals used internally */ @@ -400,7 +400,7 @@ static int grep_file(FILE *file) /* Add the line to the circular 'before' buffer */ free(before_buf[curpos]); before_buf[curpos] = line; - USE_EXTRA_COMPAT(before_buf_size[curpos] = line_len;) + IF_EXTRA_COMPAT(before_buf_size[curpos] = line_len;) curpos = (curpos + 1) % lines_before; /* avoid free(line) - we took the line */ line = NULL; @@ -544,7 +544,7 @@ int grep_main(int argc, char **argv) lines_after = 0; } else if (lines_before > 0) { before_buf = xzalloc(lines_before * sizeof(before_buf[0])); - USE_EXTRA_COMPAT(before_buf_size = xzalloc(lines_before * sizeof(before_buf_size[0]));) + IF_EXTRA_COMPAT(before_buf_size = xzalloc(lines_before * sizeof(before_buf_size[0]));) } #else /* with auto sanity checks */ diff --git a/findutils/xargs.c b/findutils/xargs.c index f22d089..76d1d54 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c @@ -356,9 +356,9 @@ enum { OPTBIT_UPTO_SIZE, OPTBIT_EOF_STRING, OPTBIT_EOF_STRING1, - USE_FEATURE_XARGS_SUPPORT_CONFIRMATION(OPTBIT_INTERACTIVE,) - USE_FEATURE_XARGS_SUPPORT_TERMOPT( OPTBIT_TERMINATE ,) - USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( OPTBIT_ZEROTERM ,) + IF_FEATURE_XARGS_SUPPORT_CONFIRMATION(OPTBIT_INTERACTIVE,) + IF_FEATURE_XARGS_SUPPORT_TERMOPT( OPTBIT_TERMINATE ,) + IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( OPTBIT_ZEROTERM ,) OPT_VERBOSE = 1 << OPTBIT_VERBOSE , OPT_NO_EMPTY = 1 << OPTBIT_NO_EMPTY , @@ -366,14 +366,14 @@ enum { OPT_UPTO_SIZE = 1 << OPTBIT_UPTO_SIZE , OPT_EOF_STRING = 1 << OPTBIT_EOF_STRING , /* GNU: -e[<param>] */ OPT_EOF_STRING1 = 1 << OPTBIT_EOF_STRING1, /* SUS: -E<param> */ - OPT_INTERACTIVE = USE_FEATURE_XARGS_SUPPORT_CONFIRMATION((1 << OPTBIT_INTERACTIVE)) + 0, - OPT_TERMINATE = USE_FEATURE_XARGS_SUPPORT_TERMOPT( (1 << OPTBIT_TERMINATE )) + 0, - OPT_ZEROTERM = USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( (1 << OPTBIT_ZEROTERM )) + 0, + OPT_INTERACTIVE = IF_FEATURE_XARGS_SUPPORT_CONFIRMATION((1 << OPTBIT_INTERACTIVE)) + 0, + OPT_TERMINATE = IF_FEATURE_XARGS_SUPPORT_TERMOPT( (1 << OPTBIT_TERMINATE )) + 0, + OPT_ZEROTERM = IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( (1 << OPTBIT_ZEROTERM )) + 0, }; #define OPTION_STR "+trn:s:e::E:" \ - USE_FEATURE_XARGS_SUPPORT_CONFIRMATION("p") \ - USE_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \ - USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0") + IF_FEATURE_XARGS_SUPPORT_CONFIRMATION("p") \ + IF_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \ + IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0") int xargs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int xargs_main(int argc, char **argv) @@ -405,7 +405,7 @@ int xargs_main(int argc, char **argv) eof_str = NULL; if (opt & OPT_ZEROTERM) - USE_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin); + IF_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin); argv += optind; argc -= optind; |