diff --git a/src/main.c b/src/main.c index e6b1a69b..d08fe9e1 100644 --- a/src/main.c +++ b/src/main.c @@ -1576,6 +1576,15 @@ void DoExit(ParsePtr p) if (PurgeMode) return; + if (JSONMode) { + if (JSONLinesEmitted) { + printf("}\n"); + } + /* Close the reminder list */ + printf("]\n"); + } + fflush(stdout); + fflush(stderr); r = EvaluateExpr(p, &v); if (r || v.type != INT_TYPE) exit(99); exit(v.v.val); diff --git a/src/trans.c b/src/trans.c index a138d69f..3e2c1bcb 100644 --- a/src/trans.c +++ b/src/trans.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,9 @@ GenerateTranslationTemplate(void) { int i; + if (JSONMode) { + return; + } printf("# Translation table template\n\n"); printf("TRANSLATE \"LANGID\" "); @@ -233,6 +237,10 @@ DumpTranslationTable(FILE *fp, int json) XlateItem *item; int done = 0; char const *t; + + if (fileno(fp) == STDOUT_FILENO && JSONMode) { + return; + } if (!json) { fprintf(fp, "# Translation table\n"); /* Always to LANGID first */