diff options
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 df632f219..da024afbf 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -62,8 +62,8 @@ | |||
62 | /* This is a NOEXEC applet. Be very careful! */ | 62 | /* This is a NOEXEC applet. Be very careful! */ |
63 | 63 | ||
64 | 64 | ||
65 | USE_FEATURE_FIND_XDEV(static dev_t *xdev_dev;) | 65 | IF_FEATURE_FIND_XDEV(static dev_t *xdev_dev;) |
66 | USE_FEATURE_FIND_XDEV(static int xdev_count;) | 66 | IF_FEATURE_FIND_XDEV(static int xdev_count;) |
67 | 67 | ||
68 | typedef int (*action_fp)(const char *fileName, struct stat *statbuf, void *); | 68 | typedef int (*action_fp)(const char *fileName, struct stat *statbuf, void *); |
69 | 69 | ||
@@ -79,23 +79,23 @@ typedef struct { | |||
79 | action_##name* ap UNUSED_PARAM) | 79 | action_##name* ap UNUSED_PARAM) |
80 | ACTS(print) | 80 | ACTS(print) |
81 | ACTS(name, const char *pattern; bool iname;) | 81 | ACTS(name, const char *pattern; bool iname;) |
82 | USE_FEATURE_FIND_PATH( ACTS(path, const char *pattern;)) | 82 | IF_FEATURE_FIND_PATH( ACTS(path, const char *pattern;)) |
83 | USE_FEATURE_FIND_REGEX( ACTS(regex, regex_t compiled_pattern;)) | 83 | IF_FEATURE_FIND_REGEX( ACTS(regex, regex_t compiled_pattern;)) |
84 | USE_FEATURE_FIND_PRINT0( ACTS(print0)) | 84 | IF_FEATURE_FIND_PRINT0( ACTS(print0)) |
85 | USE_FEATURE_FIND_TYPE( ACTS(type, int type_mask;)) | 85 | IF_FEATURE_FIND_TYPE( ACTS(type, int type_mask;)) |
86 | USE_FEATURE_FIND_PERM( ACTS(perm, char perm_char; mode_t perm_mask;)) | 86 | IF_FEATURE_FIND_PERM( ACTS(perm, char perm_char; mode_t perm_mask;)) |
87 | USE_FEATURE_FIND_MTIME( ACTS(mtime, char mtime_char; unsigned mtime_days;)) | 87 | IF_FEATURE_FIND_MTIME( ACTS(mtime, char mtime_char; unsigned mtime_days;)) |
88 | USE_FEATURE_FIND_MMIN( ACTS(mmin, char mmin_char; unsigned mmin_mins;)) | 88 | IF_FEATURE_FIND_MMIN( ACTS(mmin, char mmin_char; unsigned mmin_mins;)) |
89 | USE_FEATURE_FIND_NEWER( ACTS(newer, time_t newer_mtime;)) | 89 | IF_FEATURE_FIND_NEWER( ACTS(newer, time_t newer_mtime;)) |
90 | USE_FEATURE_FIND_INUM( ACTS(inum, ino_t inode_num;)) | 90 | IF_FEATURE_FIND_INUM( ACTS(inum, ino_t inode_num;)) |
91 | USE_FEATURE_FIND_USER( ACTS(user, uid_t uid;)) | 91 | IF_FEATURE_FIND_USER( ACTS(user, uid_t uid;)) |
92 | USE_FEATURE_FIND_SIZE( ACTS(size, char size_char; off_t size;)) | 92 | IF_FEATURE_FIND_SIZE( ACTS(size, char size_char; off_t size;)) |
93 | USE_FEATURE_FIND_CONTEXT(ACTS(context, security_context_t context;)) | 93 | IF_FEATURE_FIND_CONTEXT(ACTS(context, security_context_t context;)) |
94 | USE_FEATURE_FIND_PAREN( ACTS(paren, action ***subexpr;)) | 94 | IF_FEATURE_FIND_PAREN( ACTS(paren, action ***subexpr;)) |
95 | USE_FEATURE_FIND_PRUNE( ACTS(prune)) | 95 | IF_FEATURE_FIND_PRUNE( ACTS(prune)) |
96 | USE_FEATURE_FIND_DELETE( ACTS(delete)) | 96 | IF_FEATURE_FIND_DELETE( ACTS(delete)) |
97 | USE_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; unsigned *subst_count; int exec_argc;)) | 97 | IF_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; unsigned *subst_count; int exec_argc;)) |
98 | USE_FEATURE_FIND_GROUP( ACTS(group, gid_t gid;)) | 98 | IF_FEATURE_FIND_GROUP( ACTS(group, gid_t gid;)) |
99 | 99 | ||
100 | static action ***actions; | 100 | static action ***actions; |
101 | static bool need_print = 1; | 101 | static bool need_print = 1; |
@@ -376,8 +376,8 @@ ACTF(context) | |||
376 | 376 | ||
377 | static int FAST_FUNC fileAction(const char *fileName, | 377 | static int FAST_FUNC fileAction(const char *fileName, |
378 | struct stat *statbuf, | 378 | struct stat *statbuf, |
379 | void *userData SKIP_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM), | 379 | void *userData IF_NOT_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM), |
380 | int depth SKIP_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM)) | 380 | int depth IF_NOT_FEATURE_FIND_MAXDEPTH(UNUSED_PARAM)) |
381 | { | 381 | { |
382 | int i; | 382 | int i; |
383 | #if ENABLE_FEATURE_FIND_MAXDEPTH | 383 | #if ENABLE_FEATURE_FIND_MAXDEPTH |
@@ -451,73 +451,73 @@ static action*** parse_params(char **argv) | |||
451 | enum { | 451 | enum { |
452 | PARM_a , | 452 | PARM_a , |
453 | PARM_o , | 453 | PARM_o , |
454 | USE_FEATURE_FIND_NOT( PARM_char_not ,) | 454 | IF_FEATURE_FIND_NOT( PARM_char_not ,) |
455 | #if ENABLE_DESKTOP | 455 | #if ENABLE_DESKTOP |
456 | PARM_and , | 456 | PARM_and , |
457 | PARM_or , | 457 | PARM_or , |
458 | USE_FEATURE_FIND_NOT( PARM_not ,) | 458 | IF_FEATURE_FIND_NOT( PARM_not ,) |
459 | #endif | 459 | #endif |
460 | PARM_print , | 460 | PARM_print , |
461 | USE_FEATURE_FIND_PRINT0( PARM_print0 ,) | 461 | IF_FEATURE_FIND_PRINT0( PARM_print0 ,) |
462 | USE_FEATURE_FIND_DEPTH( PARM_depth ,) | 462 | IF_FEATURE_FIND_DEPTH( PARM_depth ,) |
463 | USE_FEATURE_FIND_PRUNE( PARM_prune ,) | 463 | IF_FEATURE_FIND_PRUNE( PARM_prune ,) |
464 | USE_FEATURE_FIND_DELETE( PARM_delete ,) | 464 | IF_FEATURE_FIND_DELETE( PARM_delete ,) |
465 | USE_FEATURE_FIND_EXEC( PARM_exec ,) | 465 | IF_FEATURE_FIND_EXEC( PARM_exec ,) |
466 | USE_FEATURE_FIND_PAREN( PARM_char_brace,) | 466 | IF_FEATURE_FIND_PAREN( PARM_char_brace,) |
467 | /* All options starting from here require argument */ | 467 | /* All options starting from here require argument */ |
468 | PARM_name , | 468 | PARM_name , |
469 | PARM_iname , | 469 | PARM_iname , |
470 | USE_FEATURE_FIND_PATH( PARM_path ,) | 470 | IF_FEATURE_FIND_PATH( PARM_path ,) |
471 | USE_FEATURE_FIND_REGEX( PARM_regex ,) | 471 | IF_FEATURE_FIND_REGEX( PARM_regex ,) |
472 | USE_FEATURE_FIND_TYPE( PARM_type ,) | 472 | IF_FEATURE_FIND_TYPE( PARM_type ,) |
473 | USE_FEATURE_FIND_PERM( PARM_perm ,) | 473 | IF_FEATURE_FIND_PERM( PARM_perm ,) |
474 | USE_FEATURE_FIND_MTIME( PARM_mtime ,) | 474 | IF_FEATURE_FIND_MTIME( PARM_mtime ,) |
475 | USE_FEATURE_FIND_MMIN( PARM_mmin ,) | 475 | IF_FEATURE_FIND_MMIN( PARM_mmin ,) |
476 | USE_FEATURE_FIND_NEWER( PARM_newer ,) | 476 | IF_FEATURE_FIND_NEWER( PARM_newer ,) |
477 | USE_FEATURE_FIND_INUM( PARM_inum ,) | 477 | IF_FEATURE_FIND_INUM( PARM_inum ,) |
478 | USE_FEATURE_FIND_USER( PARM_user ,) | 478 | IF_FEATURE_FIND_USER( PARM_user ,) |
479 | USE_FEATURE_FIND_GROUP( PARM_group ,) | 479 | IF_FEATURE_FIND_GROUP( PARM_group ,) |
480 | USE_FEATURE_FIND_SIZE( PARM_size ,) | 480 | IF_FEATURE_FIND_SIZE( PARM_size ,) |
481 | USE_FEATURE_FIND_CONTEXT(PARM_context ,) | 481 | IF_FEATURE_FIND_CONTEXT(PARM_context ,) |
482 | }; | 482 | }; |
483 | 483 | ||
484 | static const char params[] ALIGN1 = | 484 | static const char params[] ALIGN1 = |
485 | "-a\0" | 485 | "-a\0" |
486 | "-o\0" | 486 | "-o\0" |
487 | USE_FEATURE_FIND_NOT( "!\0" ) | 487 | IF_FEATURE_FIND_NOT( "!\0" ) |
488 | #if ENABLE_DESKTOP | 488 | #if ENABLE_DESKTOP |
489 | "-and\0" | 489 | "-and\0" |
490 | "-or\0" | 490 | "-or\0" |
491 | USE_FEATURE_FIND_NOT( "-not\0" ) | 491 | IF_FEATURE_FIND_NOT( "-not\0" ) |
492 | #endif | 492 | #endif |
493 | "-print\0" | 493 | "-print\0" |
494 | USE_FEATURE_FIND_PRINT0( "-print0\0" ) | 494 | IF_FEATURE_FIND_PRINT0( "-print0\0" ) |
495 | USE_FEATURE_FIND_DEPTH( "-depth\0" ) | 495 | IF_FEATURE_FIND_DEPTH( "-depth\0" ) |
496 | USE_FEATURE_FIND_PRUNE( "-prune\0" ) | 496 | IF_FEATURE_FIND_PRUNE( "-prune\0" ) |
497 | USE_FEATURE_FIND_DELETE( "-delete\0" ) | 497 | IF_FEATURE_FIND_DELETE( "-delete\0" ) |
498 | USE_FEATURE_FIND_EXEC( "-exec\0" ) | 498 | IF_FEATURE_FIND_EXEC( "-exec\0" ) |
499 | USE_FEATURE_FIND_PAREN( "(\0" ) | 499 | IF_FEATURE_FIND_PAREN( "(\0" ) |
500 | /* All options starting from here require argument */ | 500 | /* All options starting from here require argument */ |
501 | "-name\0" | 501 | "-name\0" |
502 | "-iname\0" | 502 | "-iname\0" |
503 | USE_FEATURE_FIND_PATH( "-path\0" ) | 503 | IF_FEATURE_FIND_PATH( "-path\0" ) |
504 | USE_FEATURE_FIND_REGEX( "-regex\0" ) | 504 | IF_FEATURE_FIND_REGEX( "-regex\0" ) |
505 | USE_FEATURE_FIND_TYPE( "-type\0" ) | 505 | IF_FEATURE_FIND_TYPE( "-type\0" ) |
506 | USE_FEATURE_FIND_PERM( "-perm\0" ) | 506 | IF_FEATURE_FIND_PERM( "-perm\0" ) |
507 | USE_FEATURE_FIND_MTIME( "-mtime\0" ) | 507 | IF_FEATURE_FIND_MTIME( "-mtime\0" ) |
508 | USE_FEATURE_FIND_MMIN( "-mmin\0" ) | 508 | IF_FEATURE_FIND_MMIN( "-mmin\0" ) |
509 | USE_FEATURE_FIND_NEWER( "-newer\0" ) | 509 | IF_FEATURE_FIND_NEWER( "-newer\0" ) |
510 | USE_FEATURE_FIND_INUM( "-inum\0" ) | 510 | IF_FEATURE_FIND_INUM( "-inum\0" ) |
511 | USE_FEATURE_FIND_USER( "-user\0" ) | 511 | IF_FEATURE_FIND_USER( "-user\0" ) |
512 | USE_FEATURE_FIND_GROUP( "-group\0" ) | 512 | IF_FEATURE_FIND_GROUP( "-group\0" ) |
513 | USE_FEATURE_FIND_SIZE( "-size\0" ) | 513 | IF_FEATURE_FIND_SIZE( "-size\0" ) |
514 | USE_FEATURE_FIND_CONTEXT("-context\0") | 514 | IF_FEATURE_FIND_CONTEXT("-context\0") |
515 | ; | 515 | ; |
516 | 516 | ||
517 | action*** appp; | 517 | action*** appp; |
518 | unsigned cur_group = 0; | 518 | unsigned cur_group = 0; |
519 | unsigned cur_action = 0; | 519 | unsigned cur_action = 0; |
520 | USE_FEATURE_FIND_NOT( bool invert_flag = 0; ) | 520 | IF_FEATURE_FIND_NOT( bool invert_flag = 0; ) |
521 | 521 | ||
522 | /* This is the only place in busybox where we use nested function. | 522 | /* This is the only place in busybox where we use nested function. |
523 | * So far more standard alternatives were bigger. */ | 523 | * So far more standard alternatives were bigger. */ |
@@ -530,8 +530,8 @@ static action*** parse_params(char **argv) | |||
530 | appp[cur_group][cur_action++] = ap = xmalloc(sizeof_struct); | 530 | appp[cur_group][cur_action++] = ap = xmalloc(sizeof_struct); |
531 | appp[cur_group][cur_action] = NULL; | 531 | appp[cur_group][cur_action] = NULL; |
532 | ap->f = f; | 532 | ap->f = f; |
533 | USE_FEATURE_FIND_NOT( ap->invert = invert_flag; ) | 533 | IF_FEATURE_FIND_NOT( ap->invert = invert_flag; ) |
534 | USE_FEATURE_FIND_NOT( invert_flag = 0; ) | 534 | IF_FEATURE_FIND_NOT( invert_flag = 0; ) |
535 | return ap; | 535 | return ap; |
536 | } | 536 | } |
537 | 537 | ||
@@ -569,10 +569,10 @@ static action*** parse_params(char **argv) | |||
569 | * it doesn't give smaller code. Other arches? */ | 569 | * it doesn't give smaller code. Other arches? */ |
570 | 570 | ||
571 | /* --- Operators --- */ | 571 | /* --- Operators --- */ |
572 | if (parm == PARM_a USE_DESKTOP(|| parm == PARM_and)) { | 572 | if (parm == PARM_a IF_DESKTOP(|| parm == PARM_and)) { |
573 | /* no further special handling required */ | 573 | /* no further special handling required */ |
574 | } | 574 | } |
575 | else if (parm == PARM_o USE_DESKTOP(|| parm == PARM_or)) { | 575 | else if (parm == PARM_o IF_DESKTOP(|| parm == PARM_or)) { |
576 | /* start new OR group */ | 576 | /* start new OR group */ |
577 | cur_group++; | 577 | cur_group++; |
578 | appp = xrealloc(appp, (cur_group+2) * sizeof(*appp)); | 578 | appp = xrealloc(appp, (cur_group+2) * sizeof(*appp)); |
@@ -581,7 +581,7 @@ static action*** parse_params(char **argv) | |||
581 | cur_action = 0; | 581 | cur_action = 0; |
582 | } | 582 | } |
583 | #if ENABLE_FEATURE_FIND_NOT | 583 | #if ENABLE_FEATURE_FIND_NOT |
584 | else if (parm == PARM_char_not USE_DESKTOP(|| parm == PARM_not)) { | 584 | else if (parm == PARM_char_not IF_DESKTOP(|| parm == PARM_not)) { |
585 | /* also handles "find ! ! -name 'foo*'" */ | 585 | /* also handles "find ! ! -name 'foo*'" */ |
586 | invert_flag ^= 1; | 586 | invert_flag ^= 1; |
587 | } | 587 | } |
@@ -591,13 +591,13 @@ static action*** parse_params(char **argv) | |||
591 | else if (parm == PARM_print) { | 591 | else if (parm == PARM_print) { |
592 | need_print = 0; | 592 | need_print = 0; |
593 | /* GNU find ignores '!' here: "find ! -print" */ | 593 | /* GNU find ignores '!' here: "find ! -print" */ |
594 | USE_FEATURE_FIND_NOT( invert_flag = 0; ) | 594 | IF_FEATURE_FIND_NOT( invert_flag = 0; ) |
595 | (void) ALLOC_ACTION(print); | 595 | (void) ALLOC_ACTION(print); |
596 | } | 596 | } |
597 | #if ENABLE_FEATURE_FIND_PRINT0 | 597 | #if ENABLE_FEATURE_FIND_PRINT0 |
598 | else if (parm == PARM_print0) { | 598 | else if (parm == PARM_print0) { |
599 | need_print = 0; | 599 | need_print = 0; |
600 | USE_FEATURE_FIND_NOT( invert_flag = 0; ) | 600 | IF_FEATURE_FIND_NOT( invert_flag = 0; ) |
601 | (void) ALLOC_ACTION(print0); | 601 | (void) ALLOC_ACTION(print0); |
602 | } | 602 | } |
603 | #endif | 603 | #endif |
@@ -608,7 +608,7 @@ static action*** parse_params(char **argv) | |||
608 | #endif | 608 | #endif |
609 | #if ENABLE_FEATURE_FIND_PRUNE | 609 | #if ENABLE_FEATURE_FIND_PRUNE |
610 | else if (parm == PARM_prune) { | 610 | else if (parm == PARM_prune) { |
611 | USE_FEATURE_FIND_NOT( invert_flag = 0; ) | 611 | IF_FEATURE_FIND_NOT( invert_flag = 0; ) |
612 | (void) ALLOC_ACTION(prune); | 612 | (void) ALLOC_ACTION(prune); |
613 | } | 613 | } |
614 | #endif | 614 | #endif |
@@ -624,7 +624,7 @@ static action*** parse_params(char **argv) | |||
624 | int i; | 624 | int i; |
625 | action_exec *ap; | 625 | action_exec *ap; |
626 | need_print = 0; | 626 | need_print = 0; |
627 | USE_FEATURE_FIND_NOT( invert_flag = 0; ) | 627 | IF_FEATURE_FIND_NOT( invert_flag = 0; ) |
628 | ap = ALLOC_ACTION(exec); | 628 | ap = ALLOC_ACTION(exec); |
629 | ap->exec_argv = ++argv; /* first arg after -exec */ | 629 | ap->exec_argv = ++argv; /* first arg after -exec */ |
630 | ap->exec_argc = 0; | 630 | ap->exec_argc = 0; |
@@ -813,13 +813,13 @@ int find_main(int argc, char **argv) | |||
813 | { | 813 | { |
814 | static const char options[] ALIGN1 = | 814 | static const char options[] ALIGN1 = |
815 | "-follow\0" | 815 | "-follow\0" |
816 | USE_FEATURE_FIND_XDEV( "-xdev\0" ) | 816 | IF_FEATURE_FIND_XDEV( "-xdev\0" ) |
817 | USE_FEATURE_FIND_MAXDEPTH("-mindepth\0""-maxdepth\0") | 817 | IF_FEATURE_FIND_MAXDEPTH("-mindepth\0""-maxdepth\0") |
818 | ; | 818 | ; |
819 | enum { | 819 | enum { |
820 | OPT_FOLLOW, | 820 | OPT_FOLLOW, |
821 | USE_FEATURE_FIND_XDEV( OPT_XDEV ,) | 821 | IF_FEATURE_FIND_XDEV( OPT_XDEV ,) |
822 | USE_FEATURE_FIND_MAXDEPTH(OPT_MINDEPTH,) | 822 | IF_FEATURE_FIND_MAXDEPTH(OPT_MINDEPTH,) |
823 | }; | 823 | }; |
824 | 824 | ||
825 | char *arg; | 825 | char *arg; |
diff --git a/findutils/grep.c b/findutils/grep.c index e23f9bcf3..774f04d5d 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -25,10 +25,10 @@ | |||
25 | /* options */ | 25 | /* options */ |
26 | #define OPTSTR_GREP \ | 26 | #define OPTSTR_GREP \ |
27 | "lnqvscFiHhe:f:Lorm:" \ | 27 | "lnqvscFiHhe:f:Lorm:" \ |
28 | USE_FEATURE_GREP_CONTEXT("A:B:C:") \ | 28 | IF_FEATURE_GREP_CONTEXT("A:B:C:") \ |
29 | USE_FEATURE_GREP_EGREP_ALIAS("E") \ | 29 | IF_FEATURE_GREP_EGREP_ALIAS("E") \ |
30 | USE_DESKTOP("w") \ | 30 | IF_DESKTOP("w") \ |
31 | USE_EXTRA_COMPAT("z") \ | 31 | IF_EXTRA_COMPAT("z") \ |
32 | "aI" | 32 | "aI" |
33 | 33 | ||
34 | /* ignored: -a "assume all files to be text" */ | 34 | /* ignored: -a "assume all files to be text" */ |
@@ -51,12 +51,12 @@ enum { | |||
51 | OPTBIT_o, /* show only matching parts of lines */ | 51 | OPTBIT_o, /* show only matching parts of lines */ |
52 | OPTBIT_r, /* recurse dirs */ | 52 | OPTBIT_r, /* recurse dirs */ |
53 | OPTBIT_m, /* -m MAX_MATCHES */ | 53 | OPTBIT_m, /* -m MAX_MATCHES */ |
54 | USE_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */ | 54 | IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */ |
55 | USE_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */ | 55 | IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */ |
56 | USE_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */ | 56 | IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */ |
57 | USE_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */ | 57 | IF_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */ |
58 | USE_DESKTOP( OPTBIT_w ,) /* whole word match */ | 58 | IF_DESKTOP( OPTBIT_w ,) /* whole word match */ |
59 | USE_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */ | 59 | IF_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */ |
60 | OPT_l = 1 << OPTBIT_l, | 60 | OPT_l = 1 << OPTBIT_l, |
61 | OPT_n = 1 << OPTBIT_n, | 61 | OPT_n = 1 << OPTBIT_n, |
62 | OPT_q = 1 << OPTBIT_q, | 62 | OPT_q = 1 << OPTBIT_q, |
@@ -73,12 +73,12 @@ enum { | |||
73 | OPT_o = 1 << OPTBIT_o, | 73 | OPT_o = 1 << OPTBIT_o, |
74 | OPT_r = 1 << OPTBIT_r, | 74 | OPT_r = 1 << OPTBIT_r, |
75 | OPT_m = 1 << OPTBIT_m, | 75 | OPT_m = 1 << OPTBIT_m, |
76 | OPT_A = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0, | 76 | OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0, |
77 | OPT_B = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0, | 77 | OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0, |
78 | OPT_C = USE_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0, | 78 | OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0, |
79 | OPT_E = USE_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0, | 79 | OPT_E = IF_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0, |
80 | OPT_w = USE_DESKTOP( (1 << OPTBIT_w)) + 0, | 80 | OPT_w = IF_DESKTOP( (1 << OPTBIT_w)) + 0, |
81 | OPT_z = USE_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0, | 81 | OPT_z = IF_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0, |
82 | }; | 82 | }; |
83 | 83 | ||
84 | #define PRINT_FILES_WITH_MATCHES (option_mask32 & OPT_l) | 84 | #define PRINT_FILES_WITH_MATCHES (option_mask32 & OPT_l) |
@@ -105,7 +105,7 @@ struct globals { | |||
105 | int lines_before; | 105 | int lines_before; |
106 | int lines_after; | 106 | int lines_after; |
107 | char **before_buf; | 107 | char **before_buf; |
108 | USE_EXTRA_COMPAT(size_t *before_buf_size;) | 108 | IF_EXTRA_COMPAT(size_t *before_buf_size;) |
109 | int last_line_printed; | 109 | int last_line_printed; |
110 | #endif | 110 | #endif |
111 | /* globals used internally */ | 111 | /* globals used internally */ |
@@ -400,7 +400,7 @@ static int grep_file(FILE *file) | |||
400 | /* Add the line to the circular 'before' buffer */ | 400 | /* Add the line to the circular 'before' buffer */ |
401 | free(before_buf[curpos]); | 401 | free(before_buf[curpos]); |
402 | before_buf[curpos] = line; | 402 | before_buf[curpos] = line; |
403 | USE_EXTRA_COMPAT(before_buf_size[curpos] = line_len;) | 403 | IF_EXTRA_COMPAT(before_buf_size[curpos] = line_len;) |
404 | curpos = (curpos + 1) % lines_before; | 404 | curpos = (curpos + 1) % lines_before; |
405 | /* avoid free(line) - we took the line */ | 405 | /* avoid free(line) - we took the line */ |
406 | line = NULL; | 406 | line = NULL; |
@@ -544,7 +544,7 @@ int grep_main(int argc, char **argv) | |||
544 | lines_after = 0; | 544 | lines_after = 0; |
545 | } else if (lines_before > 0) { | 545 | } else if (lines_before > 0) { |
546 | before_buf = xzalloc(lines_before * sizeof(before_buf[0])); | 546 | before_buf = xzalloc(lines_before * sizeof(before_buf[0])); |
547 | USE_EXTRA_COMPAT(before_buf_size = xzalloc(lines_before * sizeof(before_buf_size[0]));) | 547 | IF_EXTRA_COMPAT(before_buf_size = xzalloc(lines_before * sizeof(before_buf_size[0]));) |
548 | } | 548 | } |
549 | #else | 549 | #else |
550 | /* with auto sanity checks */ | 550 | /* with auto sanity checks */ |
diff --git a/findutils/xargs.c b/findutils/xargs.c index f22d089ca..76d1d5489 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c | |||
@@ -356,9 +356,9 @@ enum { | |||
356 | OPTBIT_UPTO_SIZE, | 356 | OPTBIT_UPTO_SIZE, |
357 | OPTBIT_EOF_STRING, | 357 | OPTBIT_EOF_STRING, |
358 | OPTBIT_EOF_STRING1, | 358 | OPTBIT_EOF_STRING1, |
359 | USE_FEATURE_XARGS_SUPPORT_CONFIRMATION(OPTBIT_INTERACTIVE,) | 359 | IF_FEATURE_XARGS_SUPPORT_CONFIRMATION(OPTBIT_INTERACTIVE,) |
360 | USE_FEATURE_XARGS_SUPPORT_TERMOPT( OPTBIT_TERMINATE ,) | 360 | IF_FEATURE_XARGS_SUPPORT_TERMOPT( OPTBIT_TERMINATE ,) |
361 | USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( OPTBIT_ZEROTERM ,) | 361 | IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( OPTBIT_ZEROTERM ,) |
362 | 362 | ||
363 | OPT_VERBOSE = 1 << OPTBIT_VERBOSE , | 363 | OPT_VERBOSE = 1 << OPTBIT_VERBOSE , |
364 | OPT_NO_EMPTY = 1 << OPTBIT_NO_EMPTY , | 364 | OPT_NO_EMPTY = 1 << OPTBIT_NO_EMPTY , |
@@ -366,14 +366,14 @@ enum { | |||
366 | OPT_UPTO_SIZE = 1 << OPTBIT_UPTO_SIZE , | 366 | OPT_UPTO_SIZE = 1 << OPTBIT_UPTO_SIZE , |
367 | OPT_EOF_STRING = 1 << OPTBIT_EOF_STRING , /* GNU: -e[<param>] */ | 367 | OPT_EOF_STRING = 1 << OPTBIT_EOF_STRING , /* GNU: -e[<param>] */ |
368 | OPT_EOF_STRING1 = 1 << OPTBIT_EOF_STRING1, /* SUS: -E<param> */ | 368 | OPT_EOF_STRING1 = 1 << OPTBIT_EOF_STRING1, /* SUS: -E<param> */ |
369 | OPT_INTERACTIVE = USE_FEATURE_XARGS_SUPPORT_CONFIRMATION((1 << OPTBIT_INTERACTIVE)) + 0, | 369 | OPT_INTERACTIVE = IF_FEATURE_XARGS_SUPPORT_CONFIRMATION((1 << OPTBIT_INTERACTIVE)) + 0, |
370 | OPT_TERMINATE = USE_FEATURE_XARGS_SUPPORT_TERMOPT( (1 << OPTBIT_TERMINATE )) + 0, | 370 | OPT_TERMINATE = IF_FEATURE_XARGS_SUPPORT_TERMOPT( (1 << OPTBIT_TERMINATE )) + 0, |
371 | OPT_ZEROTERM = USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( (1 << OPTBIT_ZEROTERM )) + 0, | 371 | OPT_ZEROTERM = IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( (1 << OPTBIT_ZEROTERM )) + 0, |
372 | }; | 372 | }; |
373 | #define OPTION_STR "+trn:s:e::E:" \ | 373 | #define OPTION_STR "+trn:s:e::E:" \ |
374 | USE_FEATURE_XARGS_SUPPORT_CONFIRMATION("p") \ | 374 | IF_FEATURE_XARGS_SUPPORT_CONFIRMATION("p") \ |
375 | USE_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \ | 375 | IF_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \ |
376 | USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0") | 376 | IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0") |
377 | 377 | ||
378 | int xargs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 378 | int xargs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
379 | int xargs_main(int argc, char **argv) | 379 | int xargs_main(int argc, char **argv) |
@@ -405,7 +405,7 @@ int xargs_main(int argc, char **argv) | |||
405 | eof_str = NULL; | 405 | eof_str = NULL; |
406 | 406 | ||
407 | if (opt & OPT_ZEROTERM) | 407 | if (opt & OPT_ZEROTERM) |
408 | USE_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin); | 408 | IF_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin); |
409 | 409 | ||
410 | argv += optind; | 410 | argv += optind; |
411 | argc -= optind; | 411 | argc -= optind; |