aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-07-13 20:40:40 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-07-13 20:40:40 +0200
commit8717b14f376e38998512c022b3d2b1af6e877e5e (patch)
treeb93124db65a5cdb292c95d113c57ff5a294e05b7
parent79fb6ac7a5acc4178b66314c573aeada1d387ed9 (diff)
downloadbusybox-8717b14f376e38998512c022b3d2b1af6e877e5e.tar.gz
grep: accept and ignore --color[=anything]
function old new delta grep_main 827 834 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--findutils/grep.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/findutils/grep.c b/findutils/grep.c
index 88de0d4ef..3e8ea9239 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -704,10 +704,15 @@ int grep_main(int argc UNUSED_PARAM, char **argv)
/* do normal option parsing */
#if ENABLE_FEATURE_GREP_CONTEXT
/* -H unsets -h; -C unsets -A,-B */
- opts = getopt32(argv,
- "^" OPTSTR_GREP "\0" "H-h:C-AB",
+ opts = getopt32long(argv, "^"
+ OPTSTR_GREP
+ "\0"
+ "H-h:C-AB",
+ "color\0" Optional_argument "\xff",
&pattern_head, &fopt, &max_matches,
- &lines_after, &lines_before, &Copt);
+ &lines_after, &lines_before, &Copt
+ , NULL
+ );
if (opts & OPT_C) {
/* -C unsets prev -A and -B, but following -A or -B