summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxhe <xw897002528@gmail.com>2017-11-07 13:15:13 +0800
committerrofl0r <retnyg@gmx.net>2017-11-07 15:33:40 +0000
commit8e6da23cefad907611e0ce76c3d25e5e79fa3d68 (patch)
tree06e631b3e130846f6947a9208917332630d08c93
parentbe6e739097dad30436ba97c5e72082af39b423f3 (diff)
downloadgettext-tiny-8e6da23cefad907611e0ce76c3d25e5e79fa3d68.tar.gz
msgfmt: output to messages.mo by default like GNU
I noticed GNU msgfmt did not fail when i did not specific a output file, so i decided to write the output to "messages.mo" like GNU one.
-rw-r--r--src/msgfmt.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/msgfmt.c b/src/msgfmt.c
index 6ccb56a..cb1e23b 100644
--- a/src/msgfmt.c
+++ b/src/msgfmt.c
@@ -505,7 +505,6 @@ int main(int argc, char**argv) {
FILE *out = NULL;
FILE *in = NULL;
int expect_in_fn = 1;
- int statistics = 0;
char* locale = NULL;
char* dest = NULL;
#define A argv[arg]
@@ -532,6 +531,7 @@ int main(int argc, char**argv) {
streq(A+2, "check-accelerators") ||
streq(A+2, "no-hash") ||
streq(A+2, "verbose") ||
+ streq(A+2, "statistics") ||
strstarts(A+2, "check-accelerators=") ||
strstarts(A+2, "resource=")
) {
@@ -539,8 +539,6 @@ int main(int argc, char**argv) {
locale = dest;
} else if((dest = strstarts(A+2, "output-file="))) {
set_file(1, dest, &out);
- } else if(streq(A+2, "statistics")) {
- statistics = 1;
} else if(streq(A+2, "version")) {
version();
} else if (expect_in_fn) {
@@ -592,9 +590,12 @@ int main(int argc, char**argv) {
} else return 1;
}
+ if(out == NULL) {
+ set_file(1, "messages.mo", &out);
+ }
+
if(in == NULL || out == NULL) {
- if(!statistics) syntax();
- else return 0;
+ return 1;
}
int ret = process(in, out);
fflush(in); fflush(out);