diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-12-28 14:49:46 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2019-12-28 14:49:46 -0500 |
commit | 8ae4f8f5985445b1ce3547975f407847c0fee0f7 (patch) | |
tree | a107d4e30fc4a414d2fb3fc656887651e810311e /src/config.c | |
parent | 5a754bcdc0f5e432c1d7cd358c74dfb2d6f0f1ea (diff) | |
download | spmc-8ae4f8f5985445b1ce3547975f407847c0fee0f7.tar.gz |
Documentation (and stubs)
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c index 1eaed15..7b62311 100644 --- a/src/config.c +++ b/src/config.c @@ -8,6 +8,16 @@ * * NOTE: All values are stored as strings. You need to convert non-string values yourself. * + * Example: + * ~~~{.c} + * ConfigItem **items = config_read("example.cfg"); + * if (!items) { + * // handle error + * } + * config_free(items); + * ~~~ + * + * * @param filename * @return success=`ConfigItem` array, failure=NULL */ @@ -124,7 +134,19 @@ void config_free(ConfigItem **item) { } /** - * If the configuration contains `key` return a pointer to that record + * If the `ConfigItem` array contains `key`, return a pointer to that record + * + * Example: + * ~~~{.c} + * char *nptr = NULL; + * ConfigItem *item = config_get(items, "a_number"); + * if (!item) { + * // handle error + * } + * int the_number = strtol(item->value, &nptr, 10); + * printf("%s = %d\n", item->key, the_number); + * ~~~ + * * @param item pointer to array of config records * @param key search for key in config records * @return success=pointer to record, failure=NULL |