summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-03 22:05:24 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-03 22:52:24 (GMT)
commitf84e0bd6b07b7e75e47570b8e16ae6dcd9f40d93 (patch)
tree51c74aae824487a89f76e86a800c4918e69b8ec9 /main
parent13f0b12be13e584884f00c726873f83d70f2c1d9 (diff)
downloadeeshow-f84e0bd6b07b7e75e47570b8e16ae6dcd9f40d93.zip
eeshow-f84e0bd6b07b7e75e47570b8e16ae6dcd9f40d93.tar.gz
eeshow-f84e0bd6b07b7e75e47570b8e16ae6dcd9f40d93.tar.bz2
main/eeplot.c (main): parse options before requiring -o, making -V work again
Diffstat (limited to 'main')
-rw-r--r--main/eeplot.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main/eeplot.c b/main/eeplot.c
index a78f73c..6d425cf 100644
--- a/main/eeplot.c
+++ b/main/eeplot.c
@@ -54,7 +54,7 @@ static const struct gfx_ops *find_by_output(int argc, char **argv)
if (!strncmp(argv[i], "-o", 2))
break;
if (i == argc)
- fatal("required option \"-o output\" is missing");
+ return NULL;
arg = argv[i] + 2;
if (!*arg) {
arg = argv[i + 1];
@@ -152,7 +152,7 @@ int main(int argc, char **argv)
ops = find_by_output(argc, argv);
- alloc_printf(&opts, "%s%s", OPTIONS, ops->opts);
+ alloc_printf(&opts, "%s%s", OPTIONS, ops ? ops->opts : "");
while ((c = getopt(argc, argv, opts)) != EOF)
switch (c) {
case '1':
@@ -183,6 +183,9 @@ int main(int argc, char **argv)
}
free(opts);
+ if (!ops)
+ fatal("required option \"-o output\" is missing");
+
if (argc - optind < 1)
usage(*argv);