diff options
author | Thomas White <taw@bitwiz.org.uk> | 2013-09-13 16:52:39 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2013-09-13 16:52:39 +0200 |
commit | 6dad73c50b6e35e36b955e9b771808226f44f2c8 (patch) | |
tree | db7c1c9b5fd4cda1ef6b116fbe64c895ea44fa5f /src/colloquium.c | |
parent | de00bf46d8a6a0d1fc6a61af19f108f1a7aac0b5 (diff) |
Load from command line
Diffstat (limited to 'src/colloquium.c')
-rw-r--r-- | src/colloquium.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/colloquium.c b/src/colloquium.c index 380c67b..1f372d8 100644 --- a/src/colloquium.c +++ b/src/colloquium.c @@ -34,7 +34,7 @@ static void show_help(const char *s) { - printf("Syntax: %s [options]\n\n", s); + printf("Syntax: %s [options] [<file.clq>]\n\n", s); printf( "A tiny presentation program.\n" "\n" @@ -46,7 +46,6 @@ static void show_help(const char *s) int main(int argc, char *argv[]) { int c; - struct presentation *p; /* Long options */ const struct option longopts[] = { @@ -74,12 +73,33 @@ int main(int argc, char *argv[]) } - p = new_presentation(); - p->cur_edit_slide = add_slide(p, 0); - p->completely_empty = 1; - if ( open_mainwindow(p) ) { - fprintf(stderr, "Couldn't open main window.\n"); - return 1; + if ( optind == argc ) { + + struct presentation *p; + + p = new_presentation(); + p->cur_edit_slide = add_slide(p, 0); + p->completely_empty = 1; + if ( open_mainwindow(p) ) { + fprintf(stderr, "Couldn't open main window.\n"); + return 1; + } + } + + while ( optind < argc ) { + + char *filename; + struct presentation *p; + + filename = argv[optind++]; + + p = new_presentation(); + if ( load_presentation(p, filename) ) { + fprintf(stderr, "Failed to open presentation"); + } else { + open_mainwindow(p); + } + } gtk_main(); |