MCPcopy Create free account
hub / github.com/OpenVPN/openvpn3-linux / is_colour_terminal

Function is_colour_terminal

src/common/utils.cpp:199–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197
198
199bool is_colour_terminal()
200{
201 if (getenv("NO_COLOR"))
202 {
203 return false;
204 }
205
206 if (!((isatty(STDOUT_FILENO) > 0)
207 && (isatty(STDERR_FILENO) > 0)))
208 {
209 return false;
210 }
211
212 const char *term_env = getenv("TERM");
213 std::string term(term_env ? term_env : "");
214 if (term.empty() || term == "dump")
215 {
216 return false;
217 }
218 return getenv("COLORTERM") != 0;
219}

Callers 2

EventLoggerMethod · 0.85
mainFunction · 0.85

Calls 1

emptyMethod · 0.45

Tested by 1

mainFunction · 0.68