diff options
author | xhe <xw897002528@gmail.com> | 2018-01-22 23:58:48 +0800 |
---|---|---|
committer | xhe <xw897002528@gmail.com> | 2018-01-22 23:58:48 +0800 |
commit | 5ecedfd4fd575495023aec97a23ed17f7001d015 (patch) | |
tree | e9135c1f3f0d575a08ebb08eecec5205acbf1c47 | |
parent | 63a947ac5b0dc69e86ee6faf76c65f244a5939c6 (diff) | |
download | gettext-tiny-5ecedfd4fd575495023aec97a23ed17f7001d015.tar.gz |
msgmerge: handle both '-' and files as inputs
This is a similiar issue to the one fixed in msgfmt. When the input is
'-', code stepped in to the fisrt if branch. But, this could either an
option or a '-' after '-o', or even using '-' as the input of po files.
As a result, it did not go into the set_file() function, this arg is
completely ignored.
So, here's the solution: put the handle codes in the first branch, too.
And '-' will never be missing again.
-rw-r--r-- | src/msgmerge.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/msgmerge.c b/src/msgmerge.c index ae85934..bcd9045 100644 --- a/src/msgmerge.c +++ b/src/msgmerge.c @@ -204,7 +204,26 @@ int main(int argc, char**argv) { nodir: fprintf(stderr, "EINVAL\n"); exit(1); - } else if (streq(A+1, "h")) syntax(); + } else if (streq(A+1, "h")) { + syntax(); + } else if(expect_fn.out) { + if(update && streq(A, "/dev/null")) return 0; + set_file(1, A, &files.out); + expect_fn.out = 0; + } else if(expect_fn.compend) { + set_file(1, A, &files.compend); + expect_fn.compend = 0; + } else if(expect_fn.po) { + if(update && streq(A, "/dev/null")) return 0; + set_file(0, A, &files.po); + expect_fn.po = 0; + expect_fn.pot = 1; + } else if(expect_fn.pot) { + if(update && streq(A, "/dev/null")) return 0; + set_file(0, A, &files.pot); + expect_fn.pot = 0; + } + } else if(expect_fn.out) { if(update && streq(A, "/dev/null")) return 0; set_file(1, A, &files.out); |