aboutsummaryrefslogtreecommitdiff
path: root/src/tomo.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-25 13:25:55 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-25 13:25:55 -0400
commit7994a4835b2340e12301f6897ae62e7447915f5b (patch)
tree9bb67ff18c909b077cf2f959961dd328c45e5079 /src/tomo.c
parentdbf6d326adbf480a5c60eeaf2afd92b88e85eccb (diff)
Compiler errors should use USE_COLOR
Diffstat (limited to 'src/tomo.c')
-rw-r--r--src/tomo.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tomo.c b/src/tomo.c
index 1ce63321..be4a9d9e 100644
--- a/src/tomo.c
+++ b/src/tomo.c
@@ -96,6 +96,10 @@ int main(int argc, char *argv[])
if (stat(compiler_path, &compiler_stat) != 0)
err(1, "Could not find age of compiler");
+ USE_COLOR = getenv("COLOR") ? strcmp(getenv("COLOR"), "1") == 0 : isatty(STDOUT_FILENO);
+ if (getenv("NO_COLOR") && getenv("NO_COLOR")[0] != '\0')
+ USE_COLOR = false;
+
if (register_printf_specifier('T', printf_type, printf_pointer_size))
errx(1, "Couldn't set printf specifier");
if (register_printf_specifier('W', printf_ast, printf_pointer_size))