diff options
author | xhe <xw897002528@gmail.com> | 2017-11-09 12:44:46 +0800 |
---|---|---|
committer | xhe <xw897002528@gmail.com> | 2017-11-09 12:44:46 +0800 |
commit | 2941a9c1cbc8c6ffa40c9a60473ef3dfa8d1392e (patch) | |
tree | e15384495fc7155699bb018be446bff43846df75 | |
parent | 0caeb139214781732269175d2d157ddfe74692d9 (diff) | |
download | gettext-tiny-2941a9c1cbc8c6ffa40c9a60473ef3dfa8d1392e.tar.gz |
msgfmt: take the arg as input after statements
https://github.com/sabotage-linux/gettext-tiny/issues/16#issuecomment-342928111
If we dont handle except_in_fn at the end of all other possibilities, we
may take the other flags as input file wrongly. In that case, we
will ignore the codes after that block once, since except_in_fn is
always 1 initially.
-rw-r--r-- | src/msgfmt.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/msgfmt.c b/src/msgfmt.c index 51710ab..da912bd 100644 --- a/src/msgfmt.c +++ b/src/msgfmt.c @@ -546,11 +546,12 @@ int main(int argc, char**argv) { set_file(1, dest, &out); } else if(streq(A+2, "version")) { version(); + } else if(streq(A+2, "help")) { + syntax(); } else if (expect_in_fn) { set_file(0, A, &in); expect_in_fn = 0; - } else if(streq(A+2, "help")) syntax(); - + } } else if(streq(A + 1, "o")) { arg++; dest = A; @@ -569,15 +570,15 @@ int main(int argc, char**argv) { version(); } else if (streq(A+1, "h")) { syntax(); - } else if (expect_in_fn) { - set_file(0, A, &in); - expect_in_fn = 0; } else if (streq(A+1, "l")) { arg++; locale = A; } else if (streq(A+1, "d")) { arg++; dest = A; + } else if (expect_in_fn) { + set_file(0, A, &in); + expect_in_fn = 0; } } else if (expect_in_fn) { set_file(0, A, &in); |