[ccan] Configuration file parser?

Rusty Russell rusty at rustcorp.com.au
Thu Jan 29 12:03:56 EST 2009


On Thursday 29 January 2009 04:52:20 Ryan Graham wrote:
> On Wed, Jan 28, 2009 at 1:09 AM, Tim Post <echo at echoreply.us> wrote:
> > Hi,
> >
> > Does anyone have a small library (parser included) to parse the
> > following types of configuration files:
> >
> > ** Example 1 **
> >
> > lockfile = /var/foo/shemp-is-technically-a-stooge.pid
> > lock_mem = true
...
> > I have been (for over a year) trying to think of a way to make something
> > to parse the above sane and easy to use. I have always just gone with
> > XML when I need something more complex than example #1.
> 
> The first example can be handled by a generic INI parser, which there
> are many of (like http://ndevilla.free.fr/iniparser/).

I always steal from the kernel, Tridge's junkcode, or the SAMBA project when looking for this kind of stuff.

In this case, the code (from SAMBA) has also been used by petitboot, so you can find params.[ch] here:

http://git.ozlabs.org/?p=petitboot;a=tree;f=discover;h=8b487f54df841cbd33d0b5f4e1de4bfcbbe61419;hb=refs/heads/multiple-ui

GPLv2 or later, which is fine.  Want to modernize it and turn it into a ccan module?

Thanks!
Rusty.



More information about the ccan mailing list