From: Jonas Fonseca Date: Sat, 13 Oct 2007 13:52:23 +0000 (+0200) Subject: Rearrange the order of option parsing X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bfe97931bbc4e0b93bc48a2b912d3a227deb50f3;p=tig.git Rearrange the order of option parsing --- diff --git a/tig.c b/tig.c index 06c3d04..7bbdc82 100644 --- a/tig.c +++ b/tig.c @@ -505,6 +505,26 @@ parse_options(int argc, char *argv[]) if (opt[0] && opt[0] != '-') break; + if (!strcmp(opt, "--")) { + i++; + break; + } + + if (check_option(opt, 'v', "version", OPT_NONE)) { + printf("tig version %s\n", TIG_VERSION); + return FALSE; + } + + if (check_option(opt, 'h', "help", OPT_NONE)) { + printf(usage); + return FALSE; + } + + if (!strcmp(opt, "-S")) { + opt_request = REQ_VIEW_STATUS; + continue; + } + if (!strcmp(opt, "-l")) { opt_request = REQ_VIEW_LOG; continue; @@ -515,11 +535,6 @@ parse_options(int argc, char *argv[]) continue; } - if (!strcmp(opt, "-S")) { - opt_request = REQ_VIEW_STATUS; - continue; - } - if (check_option(opt, 'n', "line-number", OPT_INT, &opt_num_interval)) { opt_line_number = TRUE; continue; @@ -530,21 +545,6 @@ parse_options(int argc, char *argv[]) continue; } - if (check_option(opt, 'v', "version", OPT_NONE)) { - printf("tig version %s\n", TIG_VERSION); - return FALSE; - } - - if (check_option(opt, 'h', "help", OPT_NONE)) { - printf(usage); - return FALSE; - } - - if (!strcmp(opt, "--")) { - i++; - break; - } - die("unknown option '%s'\n\n%s", opt, usage); }