Skip to content
Configuration language for C, inspired by nginx config syntax.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



config.c is a simple language for expressing typed, hierarchical configuration data. It is has no reliance on any of the C standard library (although will use it if available) and hence should be compatible with a broad range of embedded processors, as well as conventional computers.

Syntax Example

# '#' is a comment and the rest of the line will be ignored.

an_integer      21;
a_float         -10.32;
a_boolean       yes;            # also: `true`, `on`.
other_boolean   no;             # also: `false`, `off`.
string          "foof bar baz";

# nesting
namespace {
    foo 1;
    bar 2;
    baz 3;
    nested {
        bleem: 10;

# equivalent to: 1; 2;
namespace.baz 3;
namespace.nested.bleem 10;

Example usage

char            string_buffer[32];      /* longest decoded string value == 31 chars */
char            context_buffer[32];     /* longest context, including `.` separators == 31 chars */

void on_value(const char *key, config_type_t type, void *value_ptr) {


config_init(&config, context_buffer, 32, string_buffer, 32, on_value);

FILE *fd = fopen("test.cfg", "r");
while (!feof(fd)) config_put(&config, fgetc(fd));
int status = config_end();
Something went wrong with that request. Please try again.