diff --git a/eeshow/sch-parse.c b/eeshow/sch-parse.c index 45e298e..eb3955f 100644 --- a/eeshow/sch-parse.c +++ b/eeshow/sch-parse.c @@ -438,8 +438,10 @@ static bool parse_line(const struct file *file, void *user, const char *line) /* EndSCHEMATC */ - if (sscanf(line, "$EndSCHEMATC%n", &n) == 0 && n) - return 0; + if (sscanf(line, "$EndSCHEMATC%n", &n) == 0 && n) { + ctx->state = sch_eof; + return 1; + } break; case sch_descr: if (sscanf(line, "Title \"%m[^\"]\"", &s) == 1) { @@ -530,6 +532,8 @@ static bool parse_line(const struct file *file, void *user, const char *line) submit_obj(ctx, sch_obj_wire); ctx->state = sch_basic; return 1; + case sch_eof: + return 1; default: abort(); } diff --git a/eeshow/sch.h b/eeshow/sch.h index ddfc323..61106e4 100644 --- a/eeshow/sch.h +++ b/eeshow/sch.h @@ -29,6 +29,7 @@ enum sch_state { sch_sheet, /* sub-sheet */ sch_text, /* text or label */ sch_wire, /* wire */ + sch_eof, /* skipping anything after $EndSCHEMATC */ }; struct sheet;