roryrjb / rconf

A simple config file library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rconf

A simple config file library

About

rconf is a very simple config file parsing library and command line program suitable for scripting.

It is similar to the .ini file format in that there are multiple key value pairs, but all pairs exist in the same namespace. The format and implementation is designed to be as simple as possible. Pairs are parsed line by line in a similar way to getopt.

Installation

rconf should be able to be built on any modern UNIX or UNIX-like system, if you find this is not the case then please either file a bug or send a patch.

$ make install

Usage

In C:

#include <rconf.h>

int main(void)
{
    FILE *fp;
    size_t len = 0;
    int rconf = 0;

    fp = fopen("my.conf", "r");

    while ((rconf = rconf_get(&len, fp)) != -1) {
        printf("%s - %s\n", rconf_key, rconf_value);
    }

    return 0;
}

Using rconf(1):

$ echo "hello = world" | rconf -k hello -
world
$ rconf my.conf
here = are
some = examples

See the included man pages for more information and examples.

About

A simple config file library

License:GNU General Public License v3.0


Languages

Language:C 69.7%Language:Roff 27.6%Language:Makefile 2.7%