220 char linebuffer[1024];
222 int curmapsize, fieldnamesize;
226 fptr = fopen(filename,
"r");
230 snprintf(errbuf, errbuflen,
_(
"ERROR: Unable to open column map file %s"),
236 while (fgets(linebuffer, 1024, fptr) != NULL) ++map->
size;
239 fseek(fptr, 0, SEEK_SET);
245 while (fgets(linebuffer, 1024, fptr) != NULL)
249 fieldnamesize = strcspn(linebuffer,
"\t\n ");
254 strncpy(map->
pgfieldnames[curmapsize], tmpstr, fieldnamesize);
258 tmpstr = linebuffer + fieldnamesize;
259 tmpstr += strspn(tmpstr,
"\t\n ");
262 fieldnamesize = strcspn(tmpstr,
"\t\n ");
266 strncpy(map->
dbffieldnames[curmapsize], tmpstr, fieldnamesize);
272 int ret = snprintf(errbuf, errbuflen,
273 _(
"ERROR: column map file specifies a DBF field name \"%s\" which is longer than 10 characters"),
280 if ( errbuflen <= (
size_t)ret ) {
282 errbuf[errbuflen-1] =
'\0';
int colmap_read(const char *filename, colmap *map, char *errbuf, size_t errbuflen)
Read the content of filename into a symbol map.