Fully implement JSONTRANSLATE daemon command.

This commit is contained in:
Dianne Skoll
2024-12-10 11:57:52 -05:00
parent 0bbbaaf3d9
commit a2c818f96c
2 changed files with 8 additions and 2 deletions

View File

@@ -920,10 +920,16 @@ static void ServerWait(struct timeval *sleep_tv)
} else if (!strcmp(cmdLine, "JSONTRANSLATE\n")) {
if (!DaemonJSON) {
printf("NOTE JSONTRANSLATE\n");
} else {
printf("{");
PrintJSONKeyPairString("response", "translate");
printf("\"table\":");
}
DumpTranslationTable(stdout, 1);
if (!DaemonJSON) {
printf("NOTE ENDJSONTRANSLATE\n");
printf("\nNOTE ENDJSONTRANSLATE\n");
} else {
printf(",\"command\":\"JSONTRANSLATE\"}\n");
}
fflush(stdout);
} else if (!strcmp(cmdLine, "REREAD\n")) {

View File

@@ -161,7 +161,7 @@ DumpTranslationTable(FILE *fp, int json)
item = hash_table_next(&TranslationTable, item);
}
if (json) {
fprintf(fp, "}\n");
fprintf(fp, "}");
}
}