--- a/map.c Sat Apr 05 22:24:03 2003 +0200 +++ b/map.c Sat Apr 05 22:32:55 2003 +0200 @@ -15,9 +15,16 @@ for(i=0; map[i].string!=NULL; i++){ if(strcmp(str, map[i].string)==0) - return map[i].value; + return i; } return -1; } + +int stringintmap_value(const StringIntMap *map, const char *str, int dflt) +{ + int i=stringintmap_ndx(map, str); + return (i==-1 ? dflt : map[i].value); +} +