Skip to content
Snippets Groups Projects
Commit a7e5360f authored by Jan Niklas Hasse's avatar Jan Niklas Hasse Committed by Brad King
Browse files

Terminal: Force color output when CLICOLOR_FORCE is set != 0

See http://bixense.com/clicolors/ for documentation of this convention.
This is useful e.g. for build servers or IDE outputs.

Change-Id: I648edb4e09deda12a33328a7248dd3daf920be38
parent ed82989c
No related branches found
No related tags found
No related merge requests found
......@@ -184,14 +184,25 @@ static const char* kwsysTerminalVT100Names[] =
static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
int default_tty)
{
/* Force color according to http://bixense.com/clicolors/ convention. */
{
const char* clicolor_force = getenv("CLICOLOR_FORCE");
if (clicolor_force && *clicolor_force && strcmp(clicolor_force, "0") != 0)
{
return 1;
}
}
/* If running inside emacs the terminal is not VT100. Some emacs
seem to claim the TERM is xterm even though they do not support
VT100 escapes. */
{
const char* emacs = getenv("EMACS");
if(emacs && *emacs == 't')
{
return 0;
}
}
/* Check for a valid terminal. */
if(!default_vt100)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment