aboutsummaryrefslogtreecommitdiff
path: root/findutils/grep.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 11:09:40 +0000
commit5e34ff29bcc870936ab18172f438a34d042d4e03 (patch)
treea5e7a528f2f916eb883f1161eadceacdf2dca4be /findutils/grep.c
parent8b814b4a349e2262c0ad25793b05206a14651ebb (diff)
downloadbusybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.gz
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.tar.bz2
busybox-w32-5e34ff29bcc870936ab18172f438a34d042d4e03.zip
*: 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/grep.c')
-rw-r--r--findutils/grep.c38
1 files changed, 19 insertions, 19 deletions
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 */