Update the pcre2grep patch for colouring on Windows so that "auto" is the same

as "always".
This commit is contained in:
Philip.Hazel 2016-11-03 17:01:17 +00:00
parent e5f1ac32c0
commit 336da0bf5d
1 changed files with 18 additions and 13 deletions

View File

@ -3446,12 +3446,17 @@ if (locale != NULL)
pcre2_set_character_tables(compile_context, character_tables);
}
/* Sort out colouring */
/* Sort out colouring. On non-Windows systems "auto" causes colouring only if
the output is a terminal. On Windows systems "auto" is the same as "always". */
if (colour_option != NULL && strcmp(colour_option, "never") != 0)
{
if (strcmp(colour_option, "always") == 0) do_colour = TRUE;
#if defined(_WIN32) || defined(WIN32)
else if (strcmp(colour_option, "auto") == 0) do_colour = TRUE;
#else
else if (strcmp(colour_option, "auto") == 0) do_colour = is_stdout_tty();
#endif
else
{
fprintf(stderr, "pcre2grep: Unknown colour setting \"%s\"\n",