INI-file parser library (libinifile)
This is a C/C++ library with syntax validator for parsing ini-style configuration
files, that is, configuration files with
keyword = value entries optionally
organized under sections with section header.
For example Samba and MySQL is using this format for their configuration files. This format is also widely used in Windows for its *.ini files.
About the parser:
The library implements an validating parser where syntax check is done in parallell with the parsing. Use inifile_get_error() to differentiate between end of file condition and a parse error. Each parser has its own error object. Parser option can be set by calling inifile_set_option().
The INI-file format:
Each entry in the file is retrieved as an triple with current section, the keyword and an optional value. For example, parsing this ini-file fragment:
[section 1] key1 = val1 key2 = val2 [section 2] key3 = val3
Would return this from the parser:
ent( sect => section 1, key => key1, val => val1) ent( sect => section 1, key => key2, val => val2) ent( sect => section 2, key => key3, val => val3)
Empty and commented lines are ignored. Currently the hash character ('#') is recognized as comment begin and everthing after it is ignored.