You are not logged in.
I'm interested in writing a small server in pure C, but I'd like users to be able to configure some things (like the directory to be served) by plain text config files. Is there an easy/standard way to do this in C? I would like to avoid the following:
1. making yet another ad-hoc config language
2. writing a parser for said ad-hoc config language
3. embedding a full scripting language (like Lua)
Right now, I'm thinking of using something like YAML which has a C library for it, but I'm open to other suggestions.
Thanks,
Basu
The Bytebaker -- Computer science is not a science and it's not about computers
Check out my open source software at Github
Offline
If you like the style of pacman.conf it is a pretty easy parser to implement and use. Since it is already in C you do not even have to think that much.
*wrote it in Lua*
Offline
Both of these look promising if you don't want to embed python, lua, etc:
Offline
Glib comes with a nice ini-like config parser.
Using Glib's GKeyFile Parser
Also, consider using the XDG Base Directory Specification. I'm trying to get more people to use it because it keeps the $HOME directory clean and it separates config, data and cache. You can use the libxdg-basedir for this.
Last edited by AndreasBWagner (2010-05-02 13:06:37)
Offline