aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-03-22 17:56:10 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-03-22 17:56:10 +0000
commit0632a3c2e4474014a6c081b87c253cc55d7c2109 (patch)
treed4a265c5220c42fc69e6787b432c8e35883b94c2
parent6dac51795e5672f32bba787c0f011cb01e464a96 (diff)
downloadpuzzles-0632a3c2e4474014a6c081b87c253cc55d7c2109.zip
puzzles-0632a3c2e4474014a6c081b87c253cc55d7c2109.tar.gz
puzzles-0632a3c2e4474014a6c081b87c253cc55d7c2109.tar.bz2
puzzles-0632a3c2e4474014a6c081b87c253cc55d7c2109.tar.xz
Treat environment variable values beginning with "T" as true
So a value is true iff it begins with 'T', 't', 'Y', or 'y'. This is mostly so that naively converting JSON "true" to a string will work properly, but it should keep LISPers happy too.
-rw-r--r--misc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc.c b/misc.c
index f18f17e..659de83 100644
--- a/misc.c
+++ b/misc.c
@@ -202,7 +202,7 @@ bool getenv_bool(const char *name, bool dflt)
{
char *env = getenv(name);
if (env == NULL) return dflt;
- if (env[0] == 'y' || env[0] == 'Y') return true;
+ if (strchr("yYtT", env[0])) return true;
return false;
}