wofi-config - Man Page

Config functions and documentation

Description

The functions documented here are used for manipulating maps that represent config entries. They are defined in config.h.

Config Functions

The following functions are used to work with configs.

void config_put(struct map* map, char* line)

Parses a single config line and inserts the result into the map

struct map* map - The map to insert into.

char* line - The config line to insert. Should be in the format of key=value.

void config_load(struct map* map, const char* config)

Loads a config file into the given map

struct map* map - The map to load the config into.

const char* config - The path to a config file. Should contain lines with the format of key=value.

char* config_get(struct map* config, const char* key, char* def_opt)

Gets a config entry, if the entry is not set then it returns def_opt.

struct map* config - The map to get the value from.

const char* key - The key to lookup.

char* def_opt - The default value to be returned if the key does not exist.

uint8_t config_get_mnemonic(struct map* config, const char* key, char* def_opt, uint8_t num_choices, ...)

Gets an enum value from the config. If the value is not set then it returns def_opt.

struct map* config - The map to get the value from.

const char* key - The key to lookup.

char* def_opt - The default value to be returned if the key does not exist.

uint8_t num_choices - The number of enum options available.

varargs - The list of enum options available.