version 1.93 | | version 1.94 |
---|
| | |
/* | | /* |
* static char *rcsid_map_c = | | * static char *rcsid_map_c = |
* "$Id: map.c,v 1.93 2005/12/10 23:32:53 akirschbaum Exp $"; | | * "$Id: map.c,v 1.94 2005/12/11 11:56:17 akirschbaum Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} else { | | } else { |
*value = 0; | | *value = 0; |
value++; | | value++; |
while (isspace(*value)) value++; | | |
end = strchr(value, '\n'); | | end = strchr(value, '\n'); |
| | while (isspace(*value)) { |
| | value++; |
| | if (*value == '\0' || value == end) { |
| | /* Nothing but spaces. */ |
| | value = NULL; |
| | break; |
| | } |
| | } |
} | | } |
if (!end) { | | if (!end) { |
LOG(llevError, "Error loading map header - did not find a newline - perhaps file is truncated? Buf=%s\n", | | LOG(llevError, "Error loading map header - did not find a newline - perhaps file is truncated? Buf=%s\n", |
| | |
* value could be NULL! It would be easy enough to just point | | * value could be NULL! It would be easy enough to just point |
* this to "" to prevent cores, but that would let more errors slide | | * this to "" to prevent cores, but that would let more errors slide |
* through. | | * through. |
| | * |
| | * First check for entries that do not use the value parameter, then |
| | * validate that value is given and check for the remaining entries |
| | * that use the parameter. |
*/ | | */ |
| | |
if (!strcmp(key, "arch")) { | | if (!strcmp(key,"msg")) { |
/* This is an oddity, but not something we care about much. */ | | |
if (strcmp(value,"map\n")) | | |
LOG(llevError,"loading map and got a non 'arch map' line(%s %s)?\n",key,value); | | |
} | | |
else if (!strcmp(key,"name")) { | | |
*end=0; | | |
m->name = strdup_local(value); | | |
} else if (!strcmp(key,"msg")) { | | |
while (fgets(buf, HUGE_BUF-1, fp)!=NULL) { | | while (fgets(buf, HUGE_BUF-1, fp)!=NULL) { |
if (!strcmp(buf,"endmsg\n")) break; | | if (!strcmp(buf,"endmsg\n")) break; |
else { | | else { |
| | |
if (msgpos != 0) | | if (msgpos != 0) |
m->msg = strdup_local(msgbuf); | | m->msg = strdup_local(msgbuf); |
} | | } |
| | else if (!strcmp(key,"end")) { |
| | break; |
| | } |
| | else if (value == NULL) { |
| | LOG(llevError, "Got '%s' line without parameter in map header\n", key); |
| | } |
| | else if (!strcmp(key, "arch")) { |
| | /* This is an oddity, but not something we care about much. */ |
| | if (strcmp(value,"map\n")) |
| | LOG(llevError,"loading map and got a non 'arch map' line(%s %s)?\n",key,value); |
| | } |
| | else if (!strcmp(key,"name")) { |
| | *end=0; |
| | m->name = strdup_local(value); |
| | } |
/* first strcmp value on these are old names supported | | /* first strcmp value on these are old names supported |
* for compatibility reasons. The new values (second) are | | * for compatibility reasons. The new values (second) are |
* what really should be used. | | * what really should be used. |
| | |
} | | } |
} /* end if tile direction (in)valid */ | | } /* end if tile direction (in)valid */ |
} | | } |
else if (!strcmp(key,"end")) break; | | |
else { | | else { |
LOG(llevError,"Got unknown value in map header: %s %s\n", key, value); | | LOG(llevError,"Got unknown value in map header: %s %s\n", key, value); |
} | | } |