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: Dan Lipsitt
Subject: Re: [Confuse-devel] issues in 2.5
Date: Fri, 7 Jan 2005 17:34:37 -0500

Aha, I wasn't aware of the cfg_size() trick. That will do just what I
want. Thanks! I may just have missed it, but I think that it needs to
be mentioned in the documentation.

Another way to do it might be to have cfg_get*() produce the error.
The advantage would be that libconfuse users wouldn't have to remember
to add code to check for cfg_size() == 0. Just set the flag in one
place and you're done. You would lose the ability to write your own
error message, but if you wanted to you could still check cfg_size().

Dan

On Fri, 7 Jan 2005 23:06:58 +0100, Martin Hedenfalk <address@hidden> wrote:
> 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]