Index: work/alien_formats/eagle/eagle_bin/test_parser/eagle_bin.c =================================================================== --- work/alien_formats/eagle/eagle_bin/test_parser/eagle_bin.c (revision 9371) +++ work/alien_formats/eagle/eagle_bin/test_parser/eagle_bin.c (revision 9372) @@ -876,6 +876,7 @@ const attrs_t *at; const fmatch_t *fm; char ind[256]; + int processed = 0; memset(ind, ' ', level); ind[level] = '\0'; @@ -885,6 +886,7 @@ printf("E: short read\n"); return -1; } + processed++; if (*numblocks < 0 && load_long(block, 0, 1) == 0x10) { *numblocks = load_long(block, 4, 4); @@ -943,14 +945,15 @@ printf("About to parse %ld sub-blocks\n", numch); for(n = 0; n < numch && *numblocks != 0; n++) { int res = read_block(numblocks, level+1, ctx, f, fn); - if (res != 0) + if (res < 0) return res; + processed += res; } } - printf("blocks remaining at end of read_block routine = %ld\n", *numblocks); + printf("blocks remaining at end of read_block routine = %ld (processed=%d)\n", *numblocks, processed); - return 0; + return processed; } @@ -964,10 +967,10 @@ printf("blocks remaining prior to function call = %ld\n", *numblocks); while (*numblocks != 0) { res = read_block(numblocks, 1, ctx, f, fn); - if (res != 0) { + if (res < 0) { return res; } - printf("blocks remaining after outer function call = %ld\n\n", *numblocks); + printf("blocks remaining after outer function call = %ld (after reading %d blocks)\n\n", *numblocks, res); } printf("Section blocks have been parsed. Next job is finding DRC.\n\n");