From 3765f265542895572144683d70e7495cb8823b98 Mon Sep 17 00:00:00 2001 From: wb2osz Date: Mon, 30 Sep 2019 22:04:49 -0400 Subject: [PATCH] Default to no colors if output is not terminal. --- direwolf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/direwolf.c b/direwolf.c index a29bd18..9e609eb 100644 --- a/direwolf.c +++ b/direwolf.c @@ -59,6 +59,8 @@ #endif #if __WIN32__ +#include +#include #else #include #include @@ -252,7 +254,11 @@ int main (int argc, char *argv[]) * something else such as "tee") but command line can override this. */ +#if __WIN32__ + t_opt = _isatty(_fileno(stdout)) > 0; +#else t_opt = isatty(fileno(stdout)); +#endif /* 1 = normal, 0 = no text colors. */ /* 2, 3, ... alternate escape sequences for different terminals. */