aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authornirav <nirav@teisuu.com>2018-10-21 18:24:26 +0530
committerDandelion <nirav@teisuu.com>2018-10-21 18:24:26 +0530
commit62cdffbb4d3e93d6785f3054f7fa81b7cc8b6de7 (patch)
tree821e20b2f978890f7b9e6d6a99209a85669a842e /src/main.c
parentf8f3159f9b98b024043bd8de2c5e15dd2adf03ca (diff)
downloadim-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.c36
1 files changed, 4 insertions, 32 deletions
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 <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();