[Freeciv-Dev] Re: registry
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Wed, Dec 05, 2001 at 08:44:52AM -0500, Andrew Sutton wrote:
> char *secfile_lookup_str(struct section_file *my_section_file,
> char *path, ...)
> {
> struct entry *pentry;
> char buf[MAX_LEN_BUFFER];
> va_list ap;
>
> va_start(ap, path);
> my_vsnprintf(buf, sizeof(buf), path, ap);
> va_end(ap);
>
> if(!(pentry=section_file_lookup_internal(my_section_file, buf))) {
> freelog(LOG_FATAL, "sectionfile %s doesn't contain a '%s' entry",
> secfile_filename(my_section_file), buf);
> exit(1);
> }
>
> if(!pentry->svalue) {
> freelog(LOG_FATAL, "sectionfile %s entry '%s' doesn't contain a string",
> secfile_filename(my_section_file), buf);
> exit(1);
> }
>
> return pentry->svalue;
> }
>
> why is it a fatal error that a section doesn't include a string. it might be
> a really bad error, but i don't think it's worth exitting over... this
> eliminates the possiblity of optional configuration directives.
>
> the proper way to do this would be to handle missing required directives from
> within the ruleset loader - not the parser.
>
> i'm going to change this method since i need a little optionality for
> extended capabilities so that it just returns 0. i'll see if i can't update
> the ruleset code to actually check the error return instead of exitting.
Use section_file_lookup to test before or use
secfile_lookup_str_default to supply a default if the path isn't
found.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"I heard if you play the NT-4.0-CD backwards, you get a satanic message."
"That's nothing, if you play it forward, it installs NT-4.0"
- [Freeciv-Dev] Re: do you really want to work on the ~ (was: registry), (continued)
- [Freeciv-Dev] Re: do you really want to work on the ~ (was: registry), Reinier Post, 2001/12/08
- [Freeciv-Dev] XML, Per I. Mathisen, 2001/12/06
- [Freeciv-Dev] Re: XML, Raimar Falke, 2001/12/07
- [Freeciv-Dev] Re: XML, Daniel Sjölie, 2001/12/07
- [Freeciv-Dev] Re: XML, Petr Baudis, 2001/12/07
- [Freeciv-Dev] Re: XML, Andrew Sutton, 2001/12/07
- [Freeciv-Dev] Re: XML, Vasco Alexandre Da Silva Costa, 2001/12/07
- [Freeciv-Dev] Re: XML, Petr Baudis, 2001/12/07
- [Freeciv-Dev] Re: XML (OT), Andrew Sutton, 2001/12/07
- [Freeciv-Dev] Re: XML (OT), Petr Baudis, 2001/12/07
[Freeciv-Dev] Re: registry,
Raimar Falke <=
|
|