diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-10-12 14:05:22 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-10-12 14:05:22 -0400 |
| commit | 3cd3b20f58e9d2c6463d503be09e5d4cfaadee6c (patch) | |
| tree | 9b7120a4969a38793ecff3aab549b463c7dcf822 /src/tomo.c | |
| parent | bd190ac0a84eefa3174c04ce1fe2059aed6f2d1b (diff) | |
Code cleanup and fixing minor issues
Diffstat (limited to 'src/tomo.c')
| -rw-r--r-- | src/tomo.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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)); |
