summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-05 21:02:57 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-05 21:02:57 -0300
commit12164098658bd4bb80b107d748342f223e62b2a0 (patch)
tree2954ff0d07f96eea0b6db5862791299c4797ee7e /main.c
parentcb7002960e47960468153249c5d4d6c7a2886981 (diff)
downloadeeshow-12164098658bd4bb80b107d748342f223e62b2a0.tar.gz
eeshow-12164098658bd4bb80b107d748342f223e62b2a0.tar.bz2
eeshow-12164098658bd4bb80b107d748342f223e62b2a0.zip
eeshow/ (file_open, *_parse): return 0 on error (may still exit)
Diffstat (limited to 'main.c')
-rw-r--r--main.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/main.c b/main.c
index a29d97e..091bba8 100644
--- a/main.c
+++ b/main.c
@@ -129,8 +129,10 @@ int main(int argc, char **argv)
if (argc != optind)
usage(*argv);
- file_open(&file, cat, NULL);
- file_read(&file, file_cat, NULL);
+ if (!file_open(&file, cat, NULL))
+ return 1;
+ if (!file_read(&file, file_cat, NULL))
+ return 1;
file_close(&file);
return 0;
}
@@ -158,11 +160,13 @@ int main(int argc, char **argv)
}
sch_init(&sch_ctx, recurse);
- file_open(&sch_file, argv[dashdash - 1], NULL);
+ if (!file_open(&sch_file, argv[dashdash - 1], NULL))
+ return 1;
lib_init(&lib);
for (arg = optind; arg != dashdash - 1; arg++)
- lib_parse(&lib, argv[arg], &sch_file);
+ if (!lib_parse(&lib, argv[arg], &sch_file))
+ return 1;
if (dashdash == argc) {
gfx_argc = 1;
@@ -189,7 +193,8 @@ found:
optind = 0; /* reset getopt */
- sch_parse(&sch_ctx, &sch_file, &lib);
+ if (!sch_parse(&sch_ctx, &sch_file, &lib))
+ return 1;
file_close(&sch_file);
gfx_init(*ops, gfx_argc, gfx_argv);