[OT] Configuration file parsing

Charles Swiger cswiger at mac.com
Mon Jan 12 10:40:09 PST 2004


On Jan 12, 2004, at 5:45 AM, Philip Schulz wrote:
>  I'm currently working on a program which will be used in a closed 
> company
> environment. The programm is written in C. For this program, I need to 
> find
> a way of parsing a configuration file. I found a library which can do 
> exactly what I need, it's GLib's lexical scanner [1].

What are your requirements for this configuation file?

Something that deals with "classic" Unix config files (ie, along the 
lines of /etc/rc.conf and the like), with #-style comments and simple 
key-value assignment should only take a few hours to whip up, if you 
can't use GLib or other GPL'ed code for your circumstances.

If you need something fancier, consider lex and yacc (or flex & bison), 
but XML property lists are another alternative that might be more 
flexible.

-- 
-Chuck



More information about the freebsd-questions mailing list