grep: accept and ignore --color[=anything]

function                                             old     new   delta
grep_main                                            827     834      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-07-13 20:40:40 +02:00
parent 79fb6ac7a5
commit 8717b14f37

View File

@ -704,10 +704,15 @@ int grep_main(int argc UNUSED_PARAM, char **argv)
/* do normal option parsing */ /* do normal option parsing */
#if ENABLE_FEATURE_GREP_CONTEXT #if ENABLE_FEATURE_GREP_CONTEXT
/* -H unsets -h; -C unsets -A,-B */ /* -H unsets -h; -C unsets -A,-B */
opts = getopt32(argv, opts = getopt32long(argv, "^"
"^" OPTSTR_GREP "\0" "H-h:C-AB", OPTSTR_GREP
"\0"
"H-h:C-AB",
"color\0" Optional_argument "\xff",
&pattern_head, &fopt, &max_matches, &pattern_head, &fopt, &max_matches,
&lines_after, &lines_before, &Copt); &lines_after, &lines_before, &Copt
, NULL
);
if (opts & OPT_C) { if (opts & OPT_C) {
/* -C unsets prev -A and -B, but following -A or -B /* -C unsets prev -A and -B, but following -A or -B