1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 06:54:03 +02:00

eeshow/sch-parse.c (parse_line): no longer use return code 0 for EOF

We'll soon use it to indicate a parsing problem.
This commit is contained in:
Werner Almesberger 2016-08-05 20:41:35 -03:00
parent 59b7946a5f
commit e5f010797d
2 changed files with 7 additions and 2 deletions

View File

@ -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();
}

View File

@ -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;