23 #define CFG_MAX_LINE 256
42 void cfg_free(
struct cfg_struct* cfg);
47 int cfg_load(
struct cfg_struct* cfg,
const char* filename);
52 int cfg_save(
const struct cfg_struct* cfg,
const char* filename);
57 const char*
cfg_get(
const struct cfg_struct* cfg,
const char* key);
62 char**
cfg_get_keys(
const struct cfg_struct* cfg,
size_t* count);
67 void cfg_set(
struct cfg_struct* cfg,
const char* key,
const char* value);
72 void cfg_set_array(
struct cfg_struct* cfg,
const char* keys[],
const char* values[],
size_t count);
77 void cfg_delete(
struct cfg_struct* cfg,
const char* key);
82 void cfg_delete_array(
struct cfg_struct* cfg,
const char* keys[],
size_t count);
87 void cfg_prune(
struct cfg_struct* cfg,
const char* keys[],
size_t count);
int cfg_load(struct cfg_struct *cfg, const char *filename)
Loads key=value pairs from a file into cfg_struct.
Definition: cfg_parse.c:175
int cfg_save(const struct cfg_struct *cfg, const char *filename)
Saves a cfg_struct to a file as key=value pairs.
Definition: cfg_parse.c:222
void cfg_delete(struct cfg_struct *cfg, const char *key)
Deletes a key (and associated value) from a cfg_struct.
Definition: cfg_parse.c:420
void cfg_free(struct cfg_struct *cfg)
Frees a cfg_struct.
Definition: cfg_parse.c:145
void cfg_prune(struct cfg_struct *cfg, const char *keys[], size_t count)
Deletes all entries not found in keys[] from a cfg_struct.
Definition: cfg_parse.c:496
struct cfg_struct * cfg_init()
Creates a cfg_struct.
Definition: cfg_parse.c:131
void cfg_delete_array(struct cfg_struct *cfg, const char *keys[], size_t count)
Deletes multiple keys (and associated values) from a cfg_struct.
Definition: cfg_parse.c:474
char ** cfg_get_keys(const struct cfg_struct *cfg, size_t *count)
Retrieves a list of all keys in a cfg_struct.
Definition: cfg_parse.c:301
void cfg_set_array(struct cfg_struct *cfg, const char *keys[], const char *values[], size_t count)
Sets multiple key, value pairs in a cfg_struct.
Definition: cfg_parse.c:402
void cfg_set(struct cfg_struct *cfg, const char *key, const char *value)
Sets a key, value pair in a cfg_struct.
Definition: cfg_parse.c:341
const char * cfg_get(const struct cfg_struct *cfg, const char *key)
Retrieves a value from a cfg_struct for a specified key.
Definition: cfg_parse.c:262