Skip to content

Commit

Permalink
Merge pull request #450 from philmayers/fix-colourise
Browse files Browse the repository at this point in the history
correct the log/colourise logic
  • Loading branch information
arr2036 committed Oct 14, 2013
2 parents 1cf82b4 + 37bded5 commit 8fc2475
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 0 additions & 3 deletions src/include/radiusd.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,6 @@ typedef struct main_config_t {
char const *name;
char const *auth_badpass_msg;
char const *auth_goodpass_msg;
int colourise; //!< Messages output to stderr and
//!< stdout may be formatted using
//!< VT100 escape sequences.
int debug_memory;
} MAIN_CONFIG_T;

Expand Down
14 changes: 5 additions & 9 deletions src/main/mainconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,15 +823,11 @@ int read_mainconfig(int reload)
* We ignore colourization of output until after the
* configuration files have been parsed.
*/
if (do_colourise) {
p = getenv("TERM");
if (!p || !isatty(default_log.fd) ||
(strstr(p, "xterm") == 0)) {
mainconfig.colourise = false;
} else {
mainconfig.colourise = true;
}
p = NULL;
p = getenv("TERM");
if (do_colourise && p && isatty(default_log.fd) && strstr(p, "xterm")) {
default_log.colourise = true;
} else {
default_log.colourise = false;
}

if (mainconfig.max_request_time == 0) mainconfig.max_request_time = 100;
Expand Down

0 comments on commit 8fc2475

Please sign in to comment.