#include <stdbool.h>
#include <stdint.h>
#include <sys/stat.h>
#include <sys/types.h>
inish configuration parser. inish supports more features than the INI format and less than TOML... This module implements a recursive descent parser, see http://www.rioki.org/2016/04/18/recusive-descent-parser.html for some more information.
◆ inish_free()
Releases the memory allocated after inish_read()
has run. This function should be call once the inish configuration isn't used anymore.
- Parameters
-
conf | the inish configuration to free |
◆ inish_get_array()
Returns a inish array structure. This is the "raw" array.
- Parameters
-
section | a inish section |
key | the key of the array to return |
- Returns
- the array if found,
NULL
otherwise
◆ inish_get_bool()
Returns the boolean value for the given key.
- Parameters
-
section | a inish section |
key | the key of the value to return |
- Returns
- an optional type, indicating whether there is a value for the key and the value itself if that's the case
◆ inish_get_int()
Returns the integer value for the given key.
- Parameters
-
section | a inish section |
key | the key of the value to return |
- Returns
- an optional type, indicating whether there is a value for the key and the value itself if that's the case
◆ inish_get_ipv4()
uint8_t inish_get_ipv4 |
( |
inish_section_t * | section, |
|
|
const char * | key, |
|
|
uint8_t | ip[4] ) |
Loads an IPv4 address based on a value for the given key.
- Parameters
-
section | a inish section |
key | the key of the value to return |
ip | the array that should hold the IPv4 address |
- Returns
- the number of bytes loaded in the ip array
◆ inish_get_kv_pair()
Returns a inish key/value structure. This is the "raw" key/value but inish also offers specialized functions to directly get the value for a given key.
- Parameters
-
section | a inish section |
key | the key of pair to return |
- Returns
- the section if found,
NULL
otherwise
◆ inish_get_section()
Returns a inish section.
- Parameters
-
conf | a inish configuration |
name | the name of the section to return |
- Returns
- the section if found,
NULL
otherwise
◆ inish_get_string()
Returns the string value for the given key.
- Parameters
-
section | a inish section |
key | the key of the value to return |
- Returns
- the value if found,
NULL
otherwise
◆ inish_load()
Parses and loads a inish configuration file in memory.
- Parameters
-
filename | the configuration filename to load |
- Returns
- a inish configuration or
NULL
in case of an error