+bool parsebool(char *str, bool fallback)
+{
+ if (!strcasecmp(str, "false") || !strcasecmp(str, "no") ||
+ !strcasecmp(str, "0")) {
+ return false;
+ } else if (!strcasecmp(str, "true") || !strcasecmp(str, "yes") ||
+ !strcasecmp(str, "1")) {
+ return true;
+ } else {
+ logthing(LOGTHING_CRITICAL,
+ "Couldn't parse %s as a boolean config variable, "
+ "returning fallback of '%s'.",
+ str,
+ fallback ? "true" : "false");
+ return fallback;
+ }
+}
+