// Store the new value
return nw_string_set(entry->value, value);
}
+
+const char* nw_config_get(struct nw_config* config, const char* key) {
+ struct nw_config_entry* entry = nw_config_find(config, key);
+
+ // Return the value if found and set
+ if (entry && *entry->value)
+ return entry->value;
+
+ // Otherwise return NULL
+ return NULL;
+}
+
+unsigned int nw_config_get_unsigned_int(struct nw_config* config, const char* key) {
+ const char* value = nw_config_get(config, key);
+
+ // Return zero if not set
+ if (!value)
+ return 0;
+
+ return strtoul(value, NULL, 10);
+}
int nw_config_set(struct nw_config* config, const char* key, const char* value);
+const char* nw_config_get(struct nw_config* config, const char* key);
+unsigned int nw_config_get_unsigned_int(struct nw_config* config, const char* key);
+
#endif /* NETWORKD_CONFIG_H */