summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--doc/grep.in.19
-rw-r--r--doc/grep.texi7
-rw-r--r--src/grep.c9
4 files changed, 28 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 9ce65b34..c31c6000 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ GNU grep NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
+** New features
+
+ The new --no-ignore-case option causes grep to observe case
+ distinctions, overriding any previous -i (--ignore-case) option.
+
** Bug fixes
The exit status of 'grep -L' is no longer incorrect when standard
diff --git a/doc/grep.in.1 b/doc/grep.in.1
index a2cbf5c0..219f37f1 100644
--- a/doc/grep.in.1
+++ b/doc/grep.in.1
@@ -254,6 +254,13 @@ Ignore case distinctions in patterns and input data,
so that characters that differ only in case
match each other.
.TP
+.B \-\^\-no\-ignore\-case
+Do not ignore case distinctions in patterns and input data.
+This is the default.
+This option is useful for passing to shell scripts that already use
+.BR \-i ,
+to cancel its effects because the two options override each other.
+.TP
.BR \-v ", " \-\^\-invert\-match
Invert the sense of matching, to select non-matching lines.
.TP
@@ -683,7 +690,7 @@ Follow all symbolic links, unlike
.BR \-r .
.SS "Other Options"
.TP
-.BR \-\^\-line\-buffered
+.B \-\^\-line\-buffered
Use line buffering on output.
This can cause a performance penalty.
.TP
diff --git a/doc/grep.texi b/doc/grep.texi
index f5edc721..01ad5f74 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -215,6 +215,13 @@ SHARP S) even though lowercasing the latter yields the former.
@option{-y} is an obsolete synonym that is provided for compatibility.
(@option{-i} is specified by POSIX.)
+@item --no-ignore-case
+@opindex --no-ignore-case
+Do not ignore case distinctions in patterns and input data. This is
+the default. This option is useful for passing to shell scripts that
+already use @option{-i}, in order to cancel its effects because the
+two options override each other.
+
@item -v
@itemx --invert-match
@opindex -v
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. */