Hi folks,
I'm currently working on a project which uses various db
credentials. I had been using a simple config.h with
defines, and including it. However, then I created a shell
script which needs the same credentials, so I created a very
similar config.sh file.
So now I have duplication of
On 9 February 2011 11:19, Nick suckless-...@njw.me.uk wrote:
So, what's a good, simple format to store config files?
Obviously XML is pretty gross. So, what do people here tend
to do?
If your options are fairly simple (i.e., no nested structures etc),
you could just make the config file valid
On Wed, Feb 09, 2011 at 11:29:31AM +, Connor Lane Smith wrote:
On 9 February 2011 11:19, Nick suckless-...@njw.me.uk wrote:
So, what's a good, simple format to store config files?
Obviously XML is pretty gross. So, what do people here tend
to do?
If your options are fairly simple
In case you're too lazy to write your own parser, this is a fairly suckless
ini library: http://ndevilla.free.fr/iniparser/
While XML is pretty horrible on it's own, it is especially horrible for config
files in my experience. As long as I don't have to touch it, it works for me,
which is
Excerpts from Connor Lane Smith's message of Wed Feb 09 12:29:31 +0100 2011:
If your options are fairly simple (i.e., no nested structures etc),
you could just make the config file valid shell:
key1=value1
key2=value2
Trivial to parse in C, and you can pull the config into your script
Methods discussed in this thread (environment variables and shell
scripts) are already covered in TAOUP:
http://catb.org/~esr/writings/taoup/html/configurationchapter.html
In relation to enviornment variables for configuration. I've often
considered the possibility of using the 'envdir' tool from DJB's
daemontools package for simple configuration in things like dwm.
http://cr.yp.to/daemontools/envdir.html
It's a simple tool that sets environment variables based on
Connor Lane Smith wrote:
Nick wrote:
So, what's a good, simple format to store config files?
you could just make the config file valid shell:
key1=value1
key2=value2
Trivial to parse in C
Why bother parsing? Make those environment variables and use getenv(3).
On Wed, Feb 9, 2011 at 4:28 PM, Suraj Kurapati sun...@gmail.com wrote:
Connor Lane Smith wrote:
key1=value1
key2=value2
Trivial to parse in C
Why bother parsing? Make those environment variables and use getenv(3).
Sigh, next time I'll read the whole thread before replying. Many
others