return nw_config_set(config, key, __value);
}
+
+static const char* nw_config_true[] = {
+ "true",
+ "yes",
+ "1",
+ NULL,
+};
+
+int nw_config_get_bool(nw_config* config, const char* key) {
+ const char* value = nw_config_get(config, key);
+
+ // No value indicates false
+ if (!value)
+ return 0;
+
+ // Check if we match any known true words
+ for (const char** s = nw_config_true; *s; s++) {
+ if (strcmp(value, *s) == 0)
+ return 1;
+ }
+
+ // No match means false
+ return 0;
+}
+
+int nw_config_set_bool(nw_config* config, const char* key, const int value) {
+ return nw_config_set(config, key, value ? "true" : "false");
+}
int nw_config_get_int(nw_config* config, const char* key, const int __default);
int nw_config_set_int(nw_config* config, const char* key, const int value);
+int nw_config_get_bool(nw_config* config, const char* key);
+int nw_config_set_bool(nw_config* config, const char* key, const int value);
+
#endif /* NETWORKD_CONFIG_H */