summaryrefslogtreecommitdiff
path: root/src/grep.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-11-05 15:32:58 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-11-05 15:33:21 -0800
commit6193ba1cb5669a3e06e0320254b1c181297d41eb (patch)
tree0efe6c28d0d6ad5970d1883b7e956cf9a0b2e591 /src/grep.c
parent50312b72f570609abb85fc0add7554be0ac8721e (diff)
downloadgrep-6193ba1cb5669a3e06e0320254b1c181297d41eb.tar.gz
grep: new --no-ignore-case option
Suggested by Karl Berry and mostly implemented by Arnold Robbins (Bug#37907). * NEWS: * doc/grep.in.1: * doc/grep.texi (Matching Control): * src/grep.c (usage): Document the new option. * src/grep.c (NO_IGNORE_CASE_OPTION): New constant. (long_options, main): Support new option.
Diffstat (limited to 'src/grep.c')
-rw-r--r--src/grep.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/grep.c b/src/grep.c
index 7f3ada1f..edf90ab9 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -424,7 +424,8 @@ enum
GROUP_SEPARATOR_OPTION,
INCLUDE_OPTION,
LINE_BUFFERED_OPTION,
- LABEL_OPTION
+ LABEL_OPTION,
+ NO_IGNORE_CASE_OPTION
};
/* Long options equivalences. */
@@ -455,6 +456,7 @@ static struct option const long_options[] =
{"help", no_argument, &show_help, 1},
{"include", required_argument, NULL, INCLUDE_OPTION},
{"ignore-case", no_argument, NULL, 'i'},
+ {"no-ignore-case", no_argument, NULL, NO_IGNORE_CASE_OPTION},
{"initial-tab", no_argument, NULL, 'T'},
{"label", required_argument, NULL, LABEL_OPTION},
{"line-buffered", no_argument, NULL, LINE_BUFFERED_OPTION},
@@ -1927,6 +1929,7 @@ Pattern selection and interpretation:\n"), getprogname ());
-e, --regexp=PATTERNS use PATTERNS for matching\n\
-f, --file=FILE take PATTERNS from FILE\n\
-i, --ignore-case ignore case distinctions in patterns and data\n\
+ --no-ignore-case do not ignore case distinctions (default)\n\
-w, --word-regexp match only whole words\n\
-x, --line-regexp match only whole lines\n\
-z, --null-data a data line ends in 0 byte, not newline\n"));
@@ -2617,6 +2620,10 @@ main (int argc, char **argv)
match_icase = true;
break;
+ case NO_IGNORE_CASE_OPTION:
+ match_icase = false;
+ break;
+
case 'L':
/* Like -l, except list files that don't contain matches.
Inspired by the same option in Hume's gre. */