confuse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Confuse-devel] issues in 2.5


From: Martin Hedenfalk
Subject: Re: [Confuse-devel] issues in 2.5
Date: Fri, 7 Jan 2005 23:06:58 +0100

Hello Dan,

The purpose of the CFGF_NODEFAULT flag is to prevent libConfuse from assigning an option a default value. This can then be used after parsing to detect that mandatory options have not been specified in a config file.

A CFGF_MANDATORY flag has limited usefulness. First, when should that flag be checked? It can't be check in cfg_parse, since the caller could continue parsing other config files. Second, it is easily implemented by the caller by checking cfg_size() of the mandatory options (assuming they don't have a default value, hence the CFGF_NODEFAULT flag).

Please reply if you have another opinion, or a suggesting of how to implement it.

Thanks for your interest in libConfuse. I'll look into the cfg_print bug and update the docs.

Regards
Martin

2005-01-07 kl. 22.26 skrev Dan Lipsitt:

Here are some things I've noticed about the current version of libconfuse:

1) The CFGF_NODEFAULT option doesn't behave the way I expected it to.
I assumed (perhaps incorrectly) that if an option had CFGF_NODEFAULT
specified and a value for that option was not specified in the config
file, then an error would occur during parsing. If this was not the
intended function of CFGF_NODEFAULT, it would be a useful one to have.
Perhaps another flag could provide it. Something like CFGF_MANDATORY.

2) If a CFG_STR defaults to "" (an empty string) and isn't set in the
config file, cfg_print() will often print junk from memory for the
value of that string. However, I am having trouble producing a short
program that replicates this problem.

3) The version of the documentation at
http://www.nongnu.org/confuse/manual is still at 2.3.

Thanks, Martin for such a useful library!

Dan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]