Index: footprint.c =================================================================== --- footprint.c (revision 22508) +++ footprint.c (revision 22509) @@ -593,7 +593,7 @@ return res; } -int tedax_parse_1fp(pcb_data_t *data, FILE *fn, char *buff, int buff_size, char *argv[], int argv_size) +pcb_subc_t *tedax_parse_1fp(pcb_data_t *data, FILE *fn, char *buff, int buff_size, char *argv[], int argv_size) { pcb_subc_t *sc = pcb_subc_alloc(); pcb_subc_reg(data, sc); @@ -600,10 +600,10 @@ if (tedax_parse_1fp_(sc, fn, buff, buff_size, argv, argv_size) != 0) { pcb_subc_free(sc); - return -1; + return NULL; } - return 0; + return sc; } @@ -621,7 +621,7 @@ if (tedax_seek_block(fn, "footprint", "v1", blk_id, silent || (found > 0), line, sizeof(line), argv, sizeof(argv)/sizeof(argv[0])) < 0) break; - if (tedax_parse_1fp(data, fn, line, sizeof(line), argv, sizeof(argv)/sizeof(argv[0])) < 0) + if (tedax_parse_1fp(data, fn, line, sizeof(line), argv, sizeof(argv)/sizeof(argv[0])) == NULL) return -1; found++; } while(multi); Index: footprint.h =================================================================== --- footprint.h (revision 22508) +++ footprint.h (revision 22509) @@ -5,8 +5,8 @@ int tedax_fp_fsave(pcb_data_t *data, FILE *f); int tedax_fp_load(pcb_data_t *data, const char *fn, int multi, const char *blk_id, int silent); -/* parse a single footprint at current file pos */ -int tedax_parse_1fp(pcb_data_t *data, FILE *fn, char *buff, int buff_size, char *argv[], int argv_size); +/* parse a single footprint at current file pos; returns NULL on error */ +pcb_subc_t *tedax_parse_1fp(pcb_data_t *data, FILE *fn, char *buff, int buff_size, char *argv[], int argv_size); /* Save a single subc, with footprint header */ int tedax_fp_fsave_subc(pcb_subc_t *subc, const char *fpname, int lyrecipe, FILE *f); Index: tboard.c =================================================================== --- tboard.c (revision 22508) +++ tboard.c (revision 22509) @@ -497,7 +497,8 @@ if (tedax_seek_block(f, "footprint", "v1", NULL, silent, buff, buff_size, argv, argv_size) < 0) break; - if (tedax_parse_1fp(scdata, f, buff, buff_size, argv, argv_size) < 0) + sc = tedax_parse_1fp(scdata, f, buff, buff_size, argv, argv_size); + if (sc == NULL) errexit("Failed to parse footprint\n"); } }