libConfuse is a configuration file parser library, licensed under the terms of the ISC license, and written in C. It supports sections and (lists of) values (strings, integers, floats, booleans or other sections), as well as some other features (such as single/double-quoted strings, environment variable expansion, functions and nested include statements). It makes it very easy to add configuration file capability to a program using a simple API.
The goal of libConfuse is not to be the configuration file parser library with a gazillion of features. Instead, it aims to be easy to use and quick to integrate with your code.
libConfuse was called libcfg before, but was changed to not confuse with other similar libraries.
Homepage
Download
Recent Releases
3.326 Jun 2020 13:25
minor feature:
Support building static library on Windows.
Support for fmemopen() in Windows UWP applications.
Support for cfg_getopt(cfg, "sub=name option"), i.e., get an option from a sub-section, by Peter Rosin.
Support for CFGF_MODIFIED flag, to detect changes to settings in memory after parsing, by Peter Rosin.
Support for filtering out settings when printing, by Peter Rosin.
Support for dynamic key=value sections with no pre-runtime knowledge of setting names, useful for environment variables and similar.
Updated German translation, by Chris Leick.
loop-forever found by Christian Reitter; a.conf file containing only "=", will cause even the simplest parser to loop forever in internal function cfg_getopt_secidx().
Fail to build strdup() replacement.
build on Windows, missing fmemopen() replacement.
Handle shell and C++ comments with no space separator.
Drop developer demsg QSTR:
CFG_PTR_CB() regression, segfaults when, e.g., cfg_free() is called. Found and by Peter Rosin.
Revert CFGF_RESET flag if cfg_setmulti() family fail.
Memory leak in cfg_setopt() for PTR options.
3.2.118 Aug 2017 12:05
minor feature:
Bump ABI major number due to incompatible change in struct when adding option annotation/comments in v3.1: 1.1.0 - 2.0.0.
3.204 Jun 2017 03:16
minor feature:
Add Windows/mingw compatible fmemopen() replacement.
v3.1 regression, segfault on comment-only lines.
3.125 May 2017 08:45
minor feature:
Refactored CFGF_IGNORE_UNKNOWN support, libConfuse now properly ignores any type and sub-section without the need for declaring an __unknown option. When the flag is set all unknown options, including unknown sub-sections with, in turn, unknown options, are now fully ignored.
New API for creating titled sections at runtime, by Jonas Johansson @jonasj76.
Support for option annotation/comments. Every option can now have a comment, which is both read and written from/to file. Disabled by default, enable with CFGF_COMMENTS flag in cfg_init().
ABI bump: 1.0.0 -- 1.1.0, due to new functionality.
Build unit tests statically for easier deging.
.
Major refactor of lexer to memory leaks, cfg_free() now properly releases all memory. By Joachim Nilsson @troglobit.
.
MSVC build errors, by George Koskeridis @Gikoskos.
.
SIGSEGV when parsed default values are used with include, by Dmitri Zhabinski.
.
syntax in rpm spec file, for CentOS/RHEL7.
.
Adjust gettext version requirement to build on CentOS/RHEL7.
GNU gettext v0.18.2.1 update AM_GNU_GETTEXT() to use AC_PROG_MKDIR_P instead of AM_PROG_MKDIR_P, but v0.18.1.1 is included in Ubuntu 12.04 LTS. Fortunately Ubuntu 14.04 LTS ships v0.18.3.1 and Debian Jessie ships v0.19.3. Unfortunately, CentOS7 and RHEL7 ships v0.18.2.1, so for best compat. level at this point in time we require v0.18.2.
.
typos in documentation, by Luca Ceresoli.
.
Add fmemopen() compat for *BSD, including macOS.
3.003 Mar 2016 01:47
major feature: