From 63e8c7f9d095fe0b1e0b44f950230c0e238f166d Mon Sep 17 00:00:00 2001 From: nirav Date: Sun, 10 Mar 2019 23:45:19 +0530 Subject: Add config and log --- src/option.c | 64 ------------------------------------------------------------ 1 file changed, 64 deletions(-) delete mode 100644 src/option.c (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c deleted file mode 100644 index 011bd94..0000000 --- a/src/option.c +++ /dev/null @@ -1,64 +0,0 @@ -#define _POSIX_C_SOURCE 200809L -#include -#include -#include -#include -#include "option.h" - -static const char version[] = "qwe version 0.01"; -static const char usage[] = - "Usage: qwe [options...] \n" - "\n" - " -i Hide info bar by default.\n" - " -f Use fullscreen mode by default.\n" - " -h Show help message and quit.\n" - " -v Show the version number and quit.\n"; - -void print_usage() -{ - printf("%s\n", usage); -} - -void print_version() -{ - printf("%s\n", version); -} - -struct option _options; -const struct option *options = (const struct option *)&_options; - -void parse_options(int argc, char **argv) -{ - // default options - _options.fullscreen = false; - _options.show_info = true; - - // override options from commandline parameters - int opt; - while ((opt = getopt(argc, argv, "hvif")) != -1) { - switch (opt) { - case '?': - print_usage(); - exit(EXIT_FAILURE); - case 'h': - print_usage(); - exit(EXIT_SUCCESS); - case 'v': - print_version(); - exit(EXIT_SUCCESS); - case 'i': - _options.show_info = false; - break; - case 'f': - _options.fullscreen = true; - break; - } - } - - if (optind >= argc) { - print_usage(); - exit(EXIT_FAILURE); - } - - _options.file_name = argv[optind]; -} -- cgit v1.2.3