From 3cd3b20f58e9d2c6463d503be09e5d4cfaadee6c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 12 Oct 2025 14:05:22 -0400 Subject: Code cleanup and fixing minor issues --- src/tomo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/tomo.c') diff --git a/src/tomo.c b/src/tomo.c index 0bddb426..46076ba2 100644 --- a/src/tomo.c +++ b/src/tomo.c @@ -136,8 +136,10 @@ int main(int argc, char *argv[]) { ldlibs = Texts(ldlibs, Text(" -lexecinfo")); #endif - USE_COLOR = getenv("COLOR") ? strcmp(getenv("COLOR"), "1") == 0 : isatty(STDOUT_FILENO); - if (getenv("NO_COLOR") && getenv("NO_COLOR")[0] != '\0') USE_COLOR = false; + const char *color_env = getenv("COLOR"); + USE_COLOR = color_env ? strcmp(color_env, "1") == 0 : isatty(STDOUT_FILENO); + const char *no_color_env = getenv("NO_COLOR"); + if (no_color_env && no_color_env[0] != '\0') USE_COLOR = false; #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) arc4random_buf(TOMO_HASH_KEY, sizeof(TOMO_HASH_KEY)); -- cgit v1.2.3