aboutsummaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/grep.c b/grep.c
index 8d2c915be..dec365f05 100644
--- a/grep.c
+++ b/grep.c
@@ -104,7 +104,6 @@ extern int grep_main(int argc, char **argv)
104{ 104{
105 int opt; 105 int opt;
106 int reflags; 106 int reflags;
107 int ret;
108 107
109 /* do special-case option parsing */ 108 /* do special-case option parsing */
110 if (argv[1] && (strcmp(argv[1], "--help") == 0)) 109 if (argv[1] && (strcmp(argv[1], "--help") == 0))
@@ -147,20 +146,8 @@ extern int grep_main(int argc, char **argv)
147 reflags = REG_NOSUB | REG_NEWLINE; 146 reflags = REG_NOSUB | REG_NEWLINE;
148 if (ignore_case) 147 if (ignore_case)
149 reflags |= REG_ICASE; 148 reflags |= REG_ICASE;
150 if ((ret = regcomp(&regex, argv[optind], reflags)) != 0) { 149 if (bb_regcomp(&regex, argv[optind], reflags) != 0)
151 int errmsgsz = regerror(ret, &regex, NULL, 0);
152 char *errmsg = malloc(errmsgsz);
153 if (errmsg == NULL) {
154 fprintf(stderr, "grep: memory error\n");
155 regfree(&regex);
156 exit(1);
157 }
158 regerror(ret, &regex, errmsg, errmsgsz);
159 fprintf(stderr, "grep: %s\n", errmsg);
160 free(errmsg);
161 regfree(&regex);
162 exit(1); 150 exit(1);
163 }
164 151
165 /* argv[(optind+1)..(argc-1)] should be names of file to grep through. If 152 /* argv[(optind+1)..(argc-1)] should be names of file to grep through. If
166 * there is more than one file to grep, we will print the filenames */ 153 * there is more than one file to grep, we will print the filenames */