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

sch2fig/main.c (read_file): be civil and report errors

This commit is contained in:
Werner Almesberger 2016-07-22 00:19:19 -03:00
parent adf9efdd95
commit 09ae0229c3

View File

@ -40,6 +40,10 @@ static void read_file(const char *name, void *ctx,
char *nl; char *nl;
file = fopen(name, "r"); file = fopen(name, "r");
if (!file) {
perror(name);
exit(1);
}
while (fgets(buf, sizeof(buf), file)) { while (fgets(buf, sizeof(buf), file)) {
nl = strchr(buf, '\n'); nl = strchr(buf, '\n');
if (nl) if (nl)