Nxclib » History » Version 1
Stefan Mark, 01/02/2021 06:01 PM
| 1 | 1 | Stefan Mark | h1. Nxclib |
|---|---|---|---|
| 2 | |||
| 3 | <pre><code class="c">int nx_readkvs(const char *kvfn, nxkvs **result);</code></pre> |
||
| 4 | |||
| 5 | Loads a config file @kvfn@ into @result@ (has to be freed by %{color:dodgerblue}@nx_freekvs@%). |
||
| 6 | |||
| 7 | <pre><code class="c">int nx_loadrc(nxclibrctypes types, nxkvs **kvs);</code></pre> |
||
| 8 | |||
| 9 | Loads either the system (@nxrctype_system@) or the user (@nxrctype_user@) config into @kvs@ (has to be freed by %{color:dodgerblue}@nx_freekvs@%). The system config is stored at _/etc/nx/system.rc_, while the user config is stored at _$NX_CONFIG_HOME/session.rc_. |
||
| 10 | |||
| 11 | <pre><code class="c">void nx_freekvs(nxkvs *kvs);</code></pre> |
||
| 12 | |||
| 13 | Frees the key value store @kvs@. |
||
| 14 | |||
| 15 | <pre><code class="c">const char* nx_getkey(const char *name, const nxkvs *kvs);</code></pre> |
||
| 16 | |||
| 17 | Returns a pointer to the value of the first key @name@ in @kvs@. NULL if @name@ is not in @kvs@. |
||
| 18 | |||
| 19 | <pre><code class="c">int nx_getkeybool(const char *name, int *val, const nxkvs *kvs);</code></pre> |
||
| 20 | |||
| 21 | Returns 1 if the key @name@ exists. Gets a 1 into @val@ if the value of key @name@ is "true", 0 otherwise. |
||
| 22 | |||
| 23 | <pre><code class="c">int nx_getkeyfloat(const char *name, float *val, const nxkvs *kvs);</code></pre> |
||
| 24 | |||
| 25 | Returns 1 if the key @name@ exists and can be parsed as a float. Gets the float value into @val@. |
||
| 26 | |||
| 27 | <pre><code class="c">int nx_getkeyint(const char *name, int *val, const nxkvs *kvs);</code></pre> |
||
| 28 | |||
| 29 | Returns 1 if the key @name@ exists and can be parsed as an integer. Gets the integer value into @val@. |