+static int string_to_bool(const char *value)
+{
+ static const char true_names[] = "1\0yes\0true\0on";
+ static const char false_names[] = "0\0no\0false\0off";
+ size_t pos;
+
+ pos = 0;
+ while (pos < sizeof true_names)
+ if (strcasecmp(value, &true_names[pos]))
+ pos += 1 + strlen(&true_names[pos]);
+ else
+ return 1;
+
+ pos = 0;
+ while (pos < sizeof false_names)
+ if (strcasecmp(value, &false_names[pos]))
+ pos += 1 + strlen(&false_names[pos]);
+ else
+ return 0;
+
+ return -1;
+}
+