Config parsing (4/4): Proposed starting interface

Russ Allbery rra at stanford.edu
Sat May 12 04:36:27 UTC 2001


Russ Allbery <rra at Stanford.EDU> writes:

> Other than that, the fairly obvious interface (to me at least) is to add
> something like:

>   struct vector *conf_params(config_group);

> that returns a vector of parameter names that are set in that group.
> The caller can then compare that against a list of valid parameters, and
> also try calling config_param_<type> for each one with the expected type
> to make sure that succeeds.

Oh, and this also reminds me:  parameters know their file and line number,
but currently that information isn't exposed.  For error reporting,
obviously there needs to be a way of including that information.  I'm
currently leaning towards something like:

  conf_error_param(config_group, const char *param, const char *error);

that then reports the error message via warn, adding in the file name and
line number or whatever other locality information is appropriate (I can
easily imagine feeding chunks of configuration data to the parser
eventually that may not have come from a file).

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>


More information about the inn-workers mailing list