diff options
author | rofl0r <retnyg@gmx.net> | 2017-03-26 05:33:28 +0100 |
---|---|---|
committer | rofl0r <retnyg@gmx.net> | 2017-03-26 05:33:28 +0100 |
commit | 09c11ed0f65885bd491cee2041a939b26f28bdd1 (patch) | |
tree | 4ca27736848c85dff5c4450bb9c4720d26ada5fd | |
parent | 2d4496484e165ac403120e62d28f2756bc3f6c49 (diff) | |
download | gettext-tiny-09c11ed0f65885bd491cee2041a939b26f28bdd1.tar.gz |
msgfmt: better fix for "genuine GNU check" via --statistics
as discussed in bc018ee9d4483df17c45953809715df28f3b934b, configure
scripts check for "GNU" by running `msgfmt --statistics /dev/null`.
in our previous fix we changed --statistics from merely being ignored
to just return 0, however that breaks when it is used together with
other options during normal use, like:
msgfmt -c --statistics --verbose -o de.gmo de.po
as done by GNU coreutils.
-rw-r--r-- | src/msgfmt.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/msgfmt.c b/src/msgfmt.c index 65c9fc2..1c6badd 100644 --- a/src/msgfmt.c +++ b/src/msgfmt.c @@ -323,6 +323,7 @@ int main(int argc, char**argv) { FILE *in = NULL; int expect_out_fn = 0; int expect_in_fn = 1; + int statistics = 0; char* dest; #define A argv[arg] for(; arg < argc; arg++) { @@ -359,8 +360,7 @@ int main(int argc, char**argv) { } else if((dest = strstarts(A+2, "output-file="))) { set_file(1, dest, &out); } else if(streq(A+2, "statistics")) { - fprintf(stdout, "No Statistics available.\n"); - return 0; + statistics = 1; } else if(streq(A+2, "version")) { version(); } else if(streq(A+2, "help")) syntax(); @@ -388,7 +388,10 @@ int main(int argc, char**argv) { set_file(0, A, &in); } } - if(in == NULL || out == NULL) syntax(); + if(in == NULL || out == NULL) { + if(!statistics) syntax(); + else return 0; + } int ret = process(in, out); fflush(in); fflush(out); if(in != stdin) fclose(in); |