[collectd] I guess we need a config file

Jan Huijsmans bofh at koffie.nu
Wed Dec 14 13:59:42 CET 2005


On Wed, Dec 14, 2005 at 01:38:17PM +0100, Niki Waibel wrote:
> On 10-Dec-2005 Florian Forster wrote:
> > - Why can't I find (more) simple, effective and well documented config
> >   parsing libraries?
> 
> i'd just suggest that you look at the code of
> some other programs parsing a config file.
> 
> it should be no problem to parse an
> option: value
> file within a few read() calls...

Usually i just use a while read line case ... (ksh syntax, insert
preffered flavour) to parse the configuration.

This is no rocket science, just take the easy way out. Ignore all
lines with # or of zero length and check the rest just for the values
you'ld expect there to be. (and make sure you won't introduce buffer
overflows, configs are very usefull for these kind of exploits)

---

Jan Huijsmans              bofh at koffie.nu

... cannot activate /dev/brain, no response from main coffee server





More information about the Collectd mailing list