216 char linebuffer[1024];
218 int curmapsize, fieldnamesize;
222 fptr = fopen(filename,
"r");
226 snprintf(errbuf, errbuflen,
_(
"ERROR: Unable to open column map file %s"),
232 while (fgets(linebuffer, 1024, fptr) != NULL) ++map->
size;
235 fseek(fptr, 0, SEEK_SET);
241 while (fgets(linebuffer, 1024, fptr) != NULL)
245 fieldnamesize = strcspn(linebuffer,
"\t\n ");
250 strncpy(map->
pgfieldnames[curmapsize], tmpstr, fieldnamesize);
254 tmpstr = linebuffer + fieldnamesize;
255 tmpstr += strspn(tmpstr,
"\t\n ");
258 fieldnamesize = strcspn(tmpstr,
"\t\n ");
262 strncpy(map->
dbffieldnames[curmapsize], tmpstr, fieldnamesize);
268 snprintf(errbuf, errbuflen,
_(
"ERROR: column map file specifies a DBF field name \"%s\" which is longer than 10 characters"), map->
dbffieldnames[curmapsize]);
int colmap_read(const char *filename, colmap *map, char *errbuf, size_t errbuflen)
Read the content of filename into a symbol map.