From bfe97931bbc4e0b93bc48a2b912d3a227deb50f3 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sat, 13 Oct 2007 15:52:23 +0200 Subject: [PATCH] Rearrange the order of option parsing --- tig.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) 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); } -- 2.11.0