Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] registry
Home

[Freeciv-Dev] registry

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] registry
From: Andrew Sutton <ansutton@xxxxxxx>
Date: Wed, 5 Dec 2001 08:44:52 -0500

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.

andy


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