This may be a silly question, but is there such a thing?    Almost every
program that I know uses configuration files, often in different,
incompatible formats.   I personally prefer Samba/Wine-style config
files which are split into "sections" like this:

[SECTIONNAME1]
wibble1 = blah
wibble2 = 35
wibble3 = "a string that has more than one word"
; this is a comment -- ignored
wibble4 = 4.567e9

What I'm after is some kind of a generic parser function, which you can
give a section name "SECTIONNAME1"), a token name (e.g. "wibble1"), a
separator (e.g. "=", ":", or white space ""), and a variable of some
type (char *, int, float, etc), and have it return "true" and the
requested value if it exists, or "false" if the value was not found or
datatype was incorrectly specified.   Similarly, I want to be able to
save a value into a given section of the file, possibly replacing an
existing value, or adding a new one.

A trivial thing to write, and a very useful one -- surely it's been done
before, no?

Alex


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to