summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-05 10:24:39 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-05 10:24:39 -0300
commitf48cc4c8f085f2a7ad1daed3492299c1f25d5c68 (patch)
tree55eda71f39a0a09863cf9d85aec194f742d098e7 /main.c
parentd468d2c8a7c46fdc0a484e15fd15576cfcba59b6 (diff)
downloadeeshow-f48cc4c8f085f2a7ad1daed3492299c1f25d5c68.tar.gz
eeshow-f48cc4c8f085f2a7ad1daed3492299c1f25d5c68.tar.bz2
eeshow-f48cc4c8f085f2a7ad1daed3492299c1f25d5c68.zip
eeshow/gui.c: get only list of file names from main, parse on its own
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/main.c b/main.c
index a8e4744..4187ae8 100644
--- a/main.c
+++ b/main.c
@@ -146,6 +146,17 @@ int main(int argc, char **argv)
if (dashdash - optind < 1)
usage(*argv);
+ if (!have_dashdash) {
+ unsigned n = argc - optind;
+ char **args;
+
+ args = alloc_size(sizeof(char *) * n);
+ memcpy(args, argv + optind, sizeof(const char *) * n);
+
+ optind = 0; /* reset getopt */
+ return gui(n, args, recurse);
+ }
+
sch_init(&sch_ctx, recurse);
file_open(&sch_file, argv[dashdash - 1], NULL);
@@ -181,9 +192,6 @@ found:
sch_parse(&sch_ctx, &sch_file, &lib);
file_close(&sch_file);
- if (!have_dashdash)
- return gui(sch_ctx.sheets, argv[dashdash - 1]);
-
gfx_init(*ops, gfx_argc, gfx_argv);
if (recurse) {
const struct sheet *sheet;