aboutsummaryrefslogtreecommitdiff
path: root/findutils/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'findutils/grep.c')
-rw-r--r--findutils/grep.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/findutils/grep.c b/findutils/grep.c
index 568ab12c2..7c5f73d2f 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -107,6 +107,7 @@
//usage:#define fgrep_trivial_usage NOUSAGE_STR
//usage:#define fgrep_full_usage ""
+/* -e,-f are lists; -m,-A,-B,-C have numeric param */
#define OPTSTR_GREP \
"lnqvscFiHhe:*f:*Lorm:+wx" \
IF_FEATURE_GREP_CONTEXT("A:+B:+C:+") \
@@ -686,11 +687,9 @@ 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; -e,-f are lists;
- * -m,-A,-B,-C have numeric param */
- opt_complementary = "H-h:C-AB";
+ /* -H unsets -h; -C unsets -A,-B */
opts = getopt32(argv,
- OPTSTR_GREP,
+ "^" OPTSTR_GREP "\0" "H-h:C-AB",
&pattern_head, &fopt, &max_matches,
&lines_after, &lines_before, &Copt);
@@ -716,9 +715,7 @@ int grep_main(int argc UNUSED_PARAM, char **argv)
}
#else
/* with auto sanity checks */
- /* -H unsets -h; -c,-q or -l unset -n; -e,-f are lists; -m N */
- opt_complementary = "H-h:c-n:q-n:l-n:";
- getopt32(argv, OPTSTR_GREP,
+ getopt32(argv, "^" OPTSTR_GREP "\0" "H-h:c-n:q-n:l-n:", // why trailing ":"?
&pattern_head, &fopt, &max_matches);
#endif
invert_search = ((option_mask32 & OPT_v) != 0); /* 0 | 1 */