diff options
author | nirav <nirav@teisuu.com> | 2018-10-21 18:24:26 +0530 |
---|---|---|
committer | Dandelion <nirav@teisuu.com> | 2018-10-21 18:24:26 +0530 |
commit | 62cdffbb4d3e93d6785f3054f7fa81b7cc8b6de7 (patch) | |
tree | 821e20b2f978890f7b9e6d6a99209a85669a842e /src/main.c | |
parent | f8f3159f9b98b024043bd8de2c5e15dd2adf03ca (diff) | |
download | im-62cdffbb4d3e93d6785f3054f7fa81b7cc8b6de7.tar.gz im-62cdffbb4d3e93d6785f3054f7fa81b7cc8b6de7.zip |
Added command line option parsing, info bar is now visible by default
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 36 |
1 files changed, 4 insertions, 32 deletions
@@ -1,53 +1,25 @@ #include <gtk-3.0/gtk/gtk.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #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(); |