diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2022-05-29 16:41:50 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2022-05-29 16:42:43 -0700 |
commit | 4ac5fa8959c6366f64815de3dd94e1327242af4a (patch) | |
tree | 4dbd20d010366f952f6d352d226077201b927779 /src | |
parent | da070834819cf08ee25a209aa70ce5e57e340e9b (diff) | |
download | grep-4ac5fa8959c6366f64815de3dd94e1327242af4a.tar.gz |
grep: deprecate GREP_COLOR
This is to avoid confusion such as that reported by Cholden in:
https://bugs.gnu.org/55641
* src/grep.c (main): Warn if GREP_COLOR has an effect.
Diffstat (limited to 'src')
-rw-r--r-- | src/grep.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -295,8 +295,7 @@ static const char *group_separator = SEP_STR_GROUP; This only leaves red, magenta, green, and cyan (and their bold counterparts) and possibly bold blue. */ /* The color strings used for matched text. - The user can overwrite them using the deprecated - environment variable GREP_COLOR or the new GREP_COLORS. */ + The user can overwrite them using the GREP_COLORS environment variable. */ static const char *selected_match_color = "01;31"; /* bold red */ static const char *context_match_color = "01;31"; /* bold red */ @@ -2916,6 +2915,12 @@ main (int argc, char **argv) /* New GREP_COLORS has priority. */ parse_grep_colors (); + + /* Warn if GREP_COLOR has an effect, since it's deprecated. */ + if (selected_match_color == userval || context_match_color == userval) + error (0, 0, _("warning: GREP_COLOR='%s' is deprecated;" + " use GREP_COLORS='mt=%s'"), + userval, userval); } initialize_unibyte_mask (); |