libconfini 1.16.4

libconfini is a simple INI parsing library with the ability to read disabled entries (i.e. valid entries nested in comments). libconfini does not store the data read from an INI file, but rather dispatches it, formatted, to a custom listener. The code is written in C (C99) and does not depend on any particular library, except for the C standard headers stdio.h, stdlib.h, stdbool.h and stdint.h (and for extreme platforms the code can be also compiled as “bare metal”, with few or no strings attached to the C Standard Library).

Tags ini library unix configuration configuration-file ini-parser ini-reader ini-config conf shared-library config configuration-management gnu
License GNU GPLv3
State stable

Recent Releases

1.16.421 Jul 2022 15:03 minor bugfix: A bug has been fixed in `load_ini_path()` (`fclose()` was not invoked in case of errors). Code review (`strip_ini_cache()`, `load_ini_file()`, `load_ini_path()`; private function `further_cuts()`). Documentation. Examples.
1.16.309 Nov 2021 18:12 minor bugfix: Code review (ini_string_match_si(); private functions qultrim_h(). dqultrim_s(), get_type_as_active() and further_cuts()) - micro changes and performance optimizations only. Documentation. Examples. A small in the build system has been (see autostuff/ChangeLog.md).
1.16.225 Sep 2021 03:15 minor bugfix: Issue #16 has been fixed. Code readability. Documentation. Examples.
1.16.114 Jun 2021 19:33 minor feature: A batch script for compiling libconfini under Microsoft Windows with MSVC has been created (`msvcmake.bat`). Documentation. Examples. Package maintenance.
1.16.026 Oct 2020 20:27 minor feature: * Function `ini_get_bool_i()` has been created * Code review (private function `get_type_as_active()`; types `int8_t`, `uint8_t`, `uint16_t` and `uint32_t` have been changed to to `int_least8_t`, `uint_least8_t`, `uint_least16_t` and `uint_least32_t` everywhere) * Documentation * New examples have been created (`examples/cplusplus/map.cpp`, `examples/utilities/ini_string_preparse.h`)
1.15.006 Oct 2020 22:54 minor feature: Changes: * Public function `ini_global_set_lowercase_mode()` and global variable `INI_GLOBAL_LOWERCASE_MODE` have been marked as deprecated * Global integer constant `INI_DISABLED_FLAG` and macro `INI_IS_IMPLICIT_SUBSTR()` have been added to the public header * A minor incompatibility with **MSVC** has been solved * A small bug has been fixed (starting from version 1.10.2 `IniDispatch::v_len` was not always set to `0` in case of empty `IniDispatch::value`) * Code review (`strip_ini_cache()`) * Minor changes that affect only the build system are now documented in a separate file (see `autostuff/ChangeLog.md`) * Documentation * Examples
1.14.224 Sep 2020 18:09 cleanup: * Improved re-implementation of `stdbool.h` in case of `--with-io-api=nolibc` * Documentation * Examples * General package maintenance
1.14.111 May 2020 21:35 documentation: * Documentation
1.14.001 Mar 2020 22:04 minor feature: * Added implicit value check in `ini_array_break()`, `ini_array_collapse()`, `ini_array_release()`, `ini_array_split()`, `ini_string_parse()` and `ini_unquote()` * Integer constant `CONFINI_EROADDR` has been added to the `ConfiniInterruptNo` `enum` * Code review (`ini_array_foreach()`, `ini_get_bool()`, `ini_ntof()`, bare metal functions `ini_get_int()`, `ini_get_lint()`, `ini_get_llint()` and `ini_get_double()`, private functions `dqultrim_s()`, `get_type_as_active()`, and `qultrim_h()`) * Documentation * New examples have been created (`examples/miscellanea/parse_foreign.c`, `examples/miscellanea/toml-like.c` and `examples/utilities/clone_ini_dispatch.h`)
1.13.005 Feb 2020 20:57 minor feature: * Support for C++ has been improved * Standard header `stdbool.h` has been added to the library's public header for handling C++ compatibility * Module-definition file `src/libconfini.def` has been added to the package tree for improving compatibility with **Microsoft Windows** * Code page and UTF-8 strings in `src/winres.rc` have been adjusted * Code review * A `--without-io-api` option has been added to the `configure` script for compiling the library without the C Standard I/O API * **GNU Autotests** have been implemented (via `make check`, `make finishcheck` and `make installcheck` launch `make help` for more information about these targets) * The package tree has been re-organized all the files needed for developing the library and the documentation are now in the `dev` subdirectory * Code review in the `configure` script (options `--disable-maintainer-mode`, `--enable-author-mode` and `--enable-htmldoc` have been created; the `xargs` utility has been removed from the requirements for building the package) and in the **GNU Make** environment (`Makefile.am`: the following targets have been created: `make all-sources`, `make baremetal-csources`, `make expired`, `make official-csources`, `make official-sources`, `make official-symbols` and `make snapshot`, furthermore `make author-clean` has been renamed to `make bootstrap-clean`) * Added GCC option `-Wl,-out-implib,libconfini.lib` to the `mgwmake.bat` script * Documentation * Examples
1.12.029 Nov 2019 19:25 minor feature: Integer constants CONFINI_EBADF and CONFINI_EFBIG have been added to the ConfiniInterruptNo enum. Code review in the I/O functions load_ini_file() and load_ini_path() (made the POSIX I/O API available and made sure that all I/O failure checks are performed). Code review in the configure script (created a --with-io-api=API option for manually selecting the I/O API to use) and in the GNU Make environment (general review; created a make git-clone target). Documentation.
1.11.001 Nov 2019 18:42 minor feature: * Integer constants `CONFINI_EBADF` and `CONFINI_EFBIG` have been added to the `ConfiniInterruptNo` `enum` * Code review in the I/O functions `load_ini_file()` and `load_ini_path()` (made the POSIX I/O API available and made sure that all I/O failure checks are performed) * Code review in the `configure` script (created a `--with-io-api=API` option for manually selecting the I/O API to use) and in the **GNU Make** environment (general review; created a `make git-clone` target) * Documentation
1.10.419 Oct 2019 13:05 cleanup: * Paths of the INI files in the C examples have been changed in order to match real locations * Code review in the `configure` script (made sure not to overwrite the user-given `--docdir= DIR ` argument; created a `--disable-devel` option for generating binary-only installations -- i.e. without installing headers, static libraries, documentation, examples, etc.) and in the **GNU Make** environment (`Makefile.am`: removed `make binary-image`, `make source-image` and `make authors-suitcase` targets, renamed `make install-manifest` target to `make manifest`, created `make portable-builds` and `make oblivion-clean` targets, improved `install-data-hook` and all the helper targets; `src/Makefile.am`: moved the `CFLAGS` automatically guessed by `AC_PROG_CC_C99` to `AM_CFLAGS`) * Added call to `strip.exe` to the `mgwmake.bat` script
1.10.310 Oct 2019 13:45 minor feature: Code review (strip_ini_cache()). Subdirectory tests has been created. New examples have been created (examples/utilities/load_ini_buffer.h and examples/utilities/make_strarray.h). The configure script has been improved with a built-in support for complete package renaming (using --program-pre=PRE, --program-suf=SUFFX and --program-transform-name='s/ OLDTEXT / NEWTEXT / g ') and several new options (--enable-version-info and --disable-version-info, for enabling/disabling libtool versioning system; --enable-extended-config, for safely exporting package renamings at configure time, or any changes in configure.ac, directly to src/winres.rc and package.json see INSTALL and./configure --help for more information). The package tree has been re-organized all the files needed only at build time have been moved into the autostuff subdirectory. Documentation.
1.10.203 Oct 2019 10:25 minor feature: * Code review (`strip_ini_cache()`) * Subdirectory `tests` has been created * New examples have been created (`examples/utilities/load_ini_buffer.h` and `examples/utilities/make_strarray.h`) * The `configure` script has been improved with a built-in support for complete package renaming (using `--program-prefix=PREFIX`, `--program-suffix=SUFFX` and `--program-transform-name='s/ OLDTEXT / NEWTEXT / g '`) and several new options (`--enable-version-info` and `--disable-version-info`, for enabling/disabling **libtool** versioning system; `--enable-extended-config`, for safely exporting package renamings at `configure` time, or any changes in `configure.ac`, directly to `src/winres.rc` and `package.json` - see `INSTALL` and `./configure --help` for more information) * The package tree has been re-organized - all the files needed only at build time have been moved into the `autostuff` subdirectory * Documentation
1.10.119 Sep 2019 17:09 minor bugfix: Changes: * Code review (`strip_ini_cache()`) a small bug concerning `CR` + `LF` line breaks has been fixed
1.10.002 Aug 2019 18:25 minor feature: Changes: * Function `strip_ini_cache()` has been created see issue #9 (https://github.com/madmurphy/libconfini/issues/9) most of the code of `load_ini_file()` has now been moved to `strip_ini_cache()` * Code review (`load_ini_file()` and `load_ini_path()`) * Documentation * Created new examples (see `examples/topics/strip_ini_cache.c`)
1.9.225 Apr 2019 14:43 documentation: * Documentation * Created new examples (see examples/miscellanea/colon_as_delimiter.c)
1.9.129 Mar 2019 06:25 minor feature: Improved performance of load_ini_file() (ambiguous disabled entries that have been already tested with a negative result before invoking f_init() will be internally marked as comments for not being tested twice an example of such ambiguous disabled entries is # foo #bar ). Added --multiversion option to the autogen.sh script for future major version changes (see INSTALL). Added --with-pkgconfigdir=DIR option to the configure script. Private function dqultrim_s() has been created. Private macros _LIBCONFINI_IS_COM_MARKER_() and _LIBCONFINI_SC_INT_MARKER_ have been created. Private macro _LIBCONFINI_INLINE_MARKER_ has been renamed to _LIBCONFINI_IC_INT_MARKER_. Code review (load_ini_file(), private functions uncomment() and further_cuts()). Documentation. Examples.
1.9.026 Mar 2019 03:16 minor feature: Code review (load_ini_file(), private functions get_type_as_active() and further_cuts()). Documentation. Examples.
1.8.618 Mar 2019 02:19 minor feature: * Code review (private functions get_type_as_active(), further_cuts()) * Documentation * Examples
1.8.511 Mar 2019 01:29 documentation: * Documentation
1.8.408 Jan 2019 03:45 minor feature: Code review (ini_string_match_ss(), ini_string_match_si(), ini_array_foreach(), ini_array_split()). Documentation. Examples.
1.8.319 Nov 2018 23:14 minor feature: * Code review (ini_string_match_ss(), ini_string_match_si(), ini_array_foreach(), ini_array_split()) * Documentation * Examples
1.8.211 Nov 2018 23:20 minor feature: - Code review (private function further_cuts()) - Optimization flag -O2 seems to be working better than -O3 on Unix systems: conditionally use -O2 or -O3 depending on the host - Use libtool's -avoid-version only when compiling under native Microsoft Windows environment - Added --clean option to the autogen.sh script - Updated Autotools macros - Documentation - Examples
1.8.105 Nov 2018 06:25 minor feature: Created typedefs of callback functions (types IniStatsHandler and IniDispHandler, both required by load_ini_file() and load_ini_path(), type IniStrHandler, required by ini_array_split(), and type IniSubstrHandler, required by ini_array_foreach()). Internal macro _LIBCONFINI_INIFORMAT_AS_() has been renamed to INIFORMAT_TABLE_AS() and marked as public please note that the arguments that are passed to the user-given callback are now different. Introduced libtool versioning system for the compiled binary (versioning begins with current version 1.8.0, represented as 0:0:0); note that libtool versioning system does not affect the versioning of the project currently in use, but constitutes only a means for the linker to keep track of incompatibilities between different releases of the library. Improved support for building libconfini under Microsoft Windows (created Windows resource file src/winres.rc; conditionally added option -avoid-version to LDFLAGS in order to skip foreign libtool versioning system under Microsoft Windows; created batch script mgwmake.bat for compiling libconfini under Microsoft Windows without Autotools). Code review (ini_fton() and ini_ntof()). Updated Autotools macros. Documentation. Created new examples (see examples/topics/ini_array_foreach.c, examples/topics/ini_array_split.c and examples/miscellanea/stats_only.c).
1.8.029 Oct 2018 00:41 minor feature: * Created `typedef`s of callback functions (types `IniStatsHandler` and `IniDispHandler`, both required by `load_ini_file()` and `load_ini_path()`, type `IniStrHandler`, required by `ini_array_split()`, and type `IniSubstrHandler`, required by `ini_array_foreach()`) * Internal macro `_LIBCONFINI_INIFORMAT_AS_()` has been renamed to `INIFORMAT_TABLE_AS()` and marked as public please note that the arguments that are passed to the user-given callback are now different * Introduced **libtool** versioning system for the compiled binary (versioning begins with current version 1.8.0, represented as `0:0:0`); note that **libtool** versioning system does not affect the versioning of the project currently in use, but constitutes only a means for the linker to keep track of incompatibilities between different releases of the library * Improved support for building **libconfini** under Microsoft Windows (created Windows resource file `src/winres.rc`; conditionally added option `-avoid-version` to `LDFLAGS` in order to skip foreign **libtool** versioning system under Microsoft Windows; created batch script `mgwmake.bat` for compiling **libconfini** under Microsoft Windows without **Autotools**) * Code review (`ini_fton()` and `ini_ntof()`) * Updated **Autotools** macros * Documentation * Created new examples (see `examples/topics/ini_array_foreach.c`, `examples/topics/ini_array_split.c` and `examples/miscellanea/stats_only.c`)
1.7.319 Oct 2018 04:45 minor feature: Code review (load_ini_path() see concerning file access under Microsoft Windows). Documentation see and #6.
1.7.212 Oct 2018 12:45 minor feature: Added --disable-doc and disable-examples options to the configure script. Added --noconfigure and --help options to the autogen.sh script.
1.7.108 Oct 2018 22:13 minor feature: * Added `--disable-doc` and `disable-examples` options to the `configure` script * Added `--noconfigure` and `--help` options to the `autogen.sh` script
1.7.006 Oct 2018 13:45 minor feature: * Default format `INI_UNIXLIKE_FORMAT` has been created * `IniFormat::no_disabled_after_space` has been renamed to `IniFormat::disabled_after_space` (the field has opposite meaning now, please invert your booleans accordingly) * Moved `#include ` from `confini.c` to `confini.h` * Documentation * Examples
1.6.329 Sep 2018 22:04 minor feature: - Constant CONFINI_EFEOOR has been renamed to CONFINI_EOOR - Code review - Documentation
1.6.119 May 2018 03:15 minor feature: Functions ini_array_shift(), ini_array_break(), ini_array_release() have been created. Made sure that escapable characters cannot be used as delimiters in formats that support escape sequences. Boolean pair OFF/ON has been added to the list of supported INI booleans. Boolean pair 0/1 has been removed from the list of supported INI booleans. Public macro INIFORMAT_HAS_NO_ESC has been created. Redundant function ini_get_lazy_bool() has been removed. The buffer pointed by IniDispatch::append_to is now passed as const. Code review (ini_string_match_ss(), ini_string_match_si(), ini_string_match_ii(), ini_string_parse(), ini_array_get_length(), ini_array_foreach(), ini_array_split(), private functions uncomment() and further_cuts()). Private functions get_metachar_pos() and collapse_empty_quotes() have been created. Private functions sanitize_key_name() and get_delimiter_pos() have been renamed to collapse_everything() and getn_metachar_pos() (the latter now requires one more argument). Documentation. Examples.
1.6.015 May 2018 03:15 minor feature: Added IniFormat::section_paths option to the IniFormat bitfield. Created enum IniSectionPaths. Made sure that implicit keys containing only empty quotes are ignored in formats that support quotes. Private function ultrim_h() has been renamed to qultrim_h() and rewritten. Code review (ini_array_foreach(), ini_array_split(), ini_string_parse(), private functions get_delimiter_pos() and get_type_as_active()).
1.5.203 May 2018 03:15 minor feature: Changed fields order and sizes in the IniFormat bitfield. Changed internal values of INI_KEY, INI_SECTION, INI_DISABLED_KEY andINI_DISABLED_SECTION (see enum IniNodeType). Moved example INI files to examples/ini_files. Documentation.
1.5.129 Apr 2018 03:15 minor feature: Added IniFormat::preserve_empty_quotes option to the IniFormat bitfield. IniFormat::hash, IniFormat::semicolon and IniFormat::multiline_entries have been renamed to IniFormat::hash_marker, IniFormat::semicolon_marker and IniFormat::multiline_nodes. Function ini_string_parse() has been created. Function ini_collapse_array() has been renamed to ini_array_collapse(). Function ini_split_array() has been renamed to ini_array_split(). Function ini_set_implicit_value() has been renamed toini_global_set_implicit_value(). Function confini_global_set_lowercase_mode() has been renamed toini_global_set_lowercase_mode(). Global variable INI_INSENSITIVE_LOWERCASE has been renamed toINI_GLOBAL_LOWERCASE_MODE. Default value of INI_GLOBAL_LOWERCASE_MODE has been set to FALSE. Data type IniFormatId has been renamed to IniFormatNum. ini_format_get_id() has been renamed to ini_fton(). ini_format_set_to_id() has been renamed to ini_ntof() -- now accepts only one argument and has a return value. Constants INI_PARSE_COMMENT, INI_SHOW_COMMENT, INI_FORGET_COMMENT andINI_NORMAL_CHARACTER have been renamed to INI_DISABLED_OR_COMMENT,INI_ONLY_COMMENT, INI_IGNORE and INI_IS_NOT_A_MARKER. Constants INI_EVERYTHING_MULTILINE, INI_ACTIVE_AND_DISABLED_MULTILINE andINI_ACTIVE_MULTILINE have been renamed to INI_MULTILINE_EVERYWHERE,INI_BUT_COMMENTS, and INI_BUT_DISABLED_AND_COMMENTS. Constants CONFINI_EIINTR and CONFINI_EFEINTR have been renamed toCONFINI_IINTR and CONFINI_FEINTR. enum tags ConfiniErrorNo and IniComments have been renamed toConfiniInterruptNo and IniCommentMarker. Private function sanitize_section_name() has been renamed tosanitize_section_path(). Created private function sanitize_key_name(). Code review (ini_array_get_length(), ini_string_match_si(),ini_string_match_ii(), private functions sanitize_section_path() andcollapse_spaces()). Made sure that sections appended to root as pseudo-subsections will be dispatched always without the leading dot. Made sure that key and section names
1.5.018 Apr 2018 19:35 minor feature: Changes: * Added `IniFormat::preserve_empty_quotes` option to the `IniFormat` bitfield * `IniFormat::hash`, `IniFormat::semicolon` and `IniFormat::multiline_entries` have been renamed to `IniFormat::hash_marker`, `IniFormat::semicolon_marker` and `IniFormat::multiline_nodes` * Function `ini_string_parse()` has been created * Function `ini_collapse_array()` has been renamed to `ini_array_collapse()` * Function `ini_split_array()` has been renamed to `ini_array_split()` * Function `ini_set_implicit_value()` has been renamed to `ini_global_set_implicit_value()` * Function `confini_global_set_lowercase_mode()` has been renamed to `ini_global_set_lowercase_mode()` * Global variable `INI_INSENSITIVE_LOWERCASE` has been renamed to `INI_GLOBAL_LOWERCASE_MODE` * Default value of `INI_GLOBAL_LOWERCASE_MODE` has been set to `FALSE` * Data type `IniFormatId` has been renamed to `IniFormatNum` * `ini_format_get_id()` has been renamed to `ini_fton()` * `ini_format_set_to_id()` has been renamed to `ini_ntof()` -- now accepts only one argument and has a return value * Constants `INI_PARSE_COMMENT`, `INI_SHOW_COMMENT`, `INI_FORGET_COMMENT` and `INI_NORMAL_CHARACTER` have been renamed to `INI_DISABLED_OR_COMMENT`, `INI_ONLY_COMMENT`, `INI_IGNORE` and `INI_IS_NOT_A_MARKER` * Constants `INI_EVERYTHING_MULTILINE`, `INI_ACTIVE_AND_DISABLED_MULTILINE` and `INI_ACTIVE_MULTILINE` have been renamed to `INI_MULTILINE_EVERYWHERE`, `INI_BUT_COMMENTS`, and `INI_BUT_DISABLED_AND_COMMENTS` * Constants `CONFINI_EIINTR` and `CONFINI_EFEINTR` have been renamed to `CONFINI_IINTR` and `CONFINI_FEINTR` * `enum` tags `ConfiniErrorNo` and `IniComments` have been renamed to `ConfiniInterruptNo` and `IniCommentMarker` * Private function `sanitize_section_name()` has been renamed to `sanitize_section_path()` * Created private function `sanitize_key_name()` * Code review (`ini_array_get_length()`, `ini_string_match_si()`, `ini_string_match_ii()`, private functions `sanitize_sectio