Nxclib¶
int nx_readkvs(const char *kvfn, nxkvs **result);
Loads a config file kvfn
into result
(has to be freed by nx_freekvs
).
int nx_loadrc(nxclibrctypes types, nxkvs **kvs);
Loads either the system (nxrctype_system
) or the user (nxrctype_user
) config into kvs
(has to be freed by nx_freekvs
). The system config is stored at /etc/nx/system.rc, while the user config is stored at $NX_CONFIG_HOME/session.rc.
void nx_freekvs(nxkvs *kvs);
Frees the key value store kvs
.
const char* nx_getkey(const char *name, const nxkvs *kvs);
Returns a pointer to the value of the first key name
in kvs
. NULL if name
is not in kvs
.
int nx_getkeybool(const char *name, int *val, const nxkvs *kvs);
Returns 1 if the key name
exists. Gets a 1 into val
if the value of key name
is "true", 0 otherwise.
int nx_getkeyfloat(const char *name, float *val, const nxkvs *kvs);
Returns 1 if the key name
exists and can be parsed as a float. Gets the float value into val
.
int nx_getkeyint(const char *name, int *val, const nxkvs *kvs);
Returns 1 if the key name
exists and can be parsed as an integer. Gets the integer value into val
.
Updated by Stefan Mark almost 5 years ago · 1 revisions