Configuration parser and integers
rra at stanford.edu
Tue Nov 3 01:14:20 UTC 2009
Julien ÉLIE <julien at trigofacile.com> writes:
> The configuration parser defines numbers:
> integer = ["-"] 1*DIGIT
> but a lot of them must be positive.
> Should we do something about that at the level of the parser?
> (defining a positive integer?)
We could, but as you can see from lib/innconf.c, defining additional data
types at the level of the configuration syntax is a little annoying, since
it expands the union and requires new cases and macros. It might be the
best and most robust approach, though, since it would make it easy to
catch all of them without adding a bunch more validation.
> or at the level of innconf_validate? (exiting if something
> is bad)
That's where we should do something if we aren't going to add an unsigned
number type to the configuration syntax.
> or do nothing because it is the fault of the news admin?
No, we should diagnose the error. I'd never thought about that before.
Russ Allbery (rra at stanford.edu) <http://www.eyrie.org/~eagle/>
Please send questions to the list rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
More information about the inn-workers