From 62cdffbb4d3e93d6785f3054f7fa81b7cc8b6de7 Mon Sep 17 00:00:00 2001 From: nirav Date: Sun, 21 Oct 2018 18:24:26 +0530 Subject: Added command line option parsing, info bar is now visible by default --- src/main.c | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 21dd14e..9b67bf2 100644 --- a/src/main.c +++ b/src/main.c @@ -1,53 +1,25 @@ #include #include #include -#include #include "file.h" #include "image.h" +#include "option.h" #include "window.h" -void print_usage() -{ - printf("qwe [filename]\n"); -} - -void print_version() -{ - printf("0.01\n"); -} - int main(int argc, char **argv) { gtk_init(&argc, &argv); - int opt; - while ((opt = getopt(argc, argv, "hv")) != -1) { - switch (opt) { - case '?': - print_usage(); - exit(EXIT_FAILURE); - case 'h': - print_usage(); - exit(EXIT_SUCCESS); - case 'v': - print_version(); - exit(EXIT_SUCCESS); - } - } - - if (optind >= argc) { - print_usage(); - exit(EXIT_FAILURE); - } + parse_options(argc, argv); // load the specified image - if (load_image(argv[optind])) { + if (load_image(options->file_name)) { exit(EXIT_FAILURE); } // scan other supported image file in the same dir - scan(argv[optind]); + scan(options->file_name); create_main_window(); gtk_main(); -- cgit v1.2.3