diff options
author | Mark Whitley | 2000-07-11 16:53:56 +0000 |
---|---|---|
committer | Mark Whitley | 2000-07-11 16:53:56 +0000 |
commit | df5f6ba1159f8c1af500fa1b8eb9c9646e4de2a6 (patch) | |
tree | 90005f171e95b4fc0eefca5171593ba0b105b3f7 /findutils | |
parent | da9841efc1e924ab3f645d931ae17c6d4aaf766f (diff) | |
download | busybox-df5f6ba1159f8c1af500fa1b8eb9c9646e4de2a6.zip busybox-df5f6ba1159f8c1af500fa1b8eb9c9646e4de2a6.tar.gz |
Applied patch from Matt Kraai which does the following:
- adds case-insensitive matching in sed s/// epxressions
- consolodates common regcomp code in grep & sed into bb_regcomp and put in
utility.c
- cleans up a bunch of cruft
Diffstat (limited to 'findutils')
-rw-r--r-- | findutils/grep.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index 8d2c915..dec365f 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -104,7 +104,6 @@ extern int grep_main(int argc, char **argv) { int opt; int reflags; - int ret; /* do special-case option parsing */ if (argv[1] && (strcmp(argv[1], "--help") == 0)) @@ -147,20 +146,8 @@ extern int grep_main(int argc, char **argv) reflags = REG_NOSUB | REG_NEWLINE; if (ignore_case) reflags |= REG_ICASE; - if ((ret = regcomp(®ex, argv[optind], reflags)) != 0) { - int errmsgsz = regerror(ret, ®ex, NULL, 0); - char *errmsg = malloc(errmsgsz); - if (errmsg == NULL) { - fprintf(stderr, "grep: memory error\n"); - regfree(®ex); - exit(1); - } - regerror(ret, ®ex, errmsg, errmsgsz); - fprintf(stderr, "grep: %s\n", errmsg); - free(errmsg); - regfree(®ex); + if (bb_regcomp(®ex, argv[optind], reflags) != 0) exit(1); - } /* argv[(optind+1)..(argc-1)] should be names of file to grep through. If * there is more than one file to grep, we will print the filenames */ |