aboutsummaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index c4c4b69..f18f17e 100644
--- a/misc.c
+++ b/misc.c
@@ -198,6 +198,14 @@ char *fgetline(FILE *fp)
return ret;
}
+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;
+ return false;
+}
+
/* Utility functions for colour manipulation. */
static float colour_distance(const float a[3], const float b[3])