src/main.c: fix issue #1587 by using jv_dumpf in the raw-output and ascii-output case. retain fwrite in the raw-output case.

This commit is contained in:
rain1 authored and Nico Williams committed 2018-03-01 14:33:47 -06:00
1 parent ae11f111a5
commit bf88c73c20
1 file changed
+5 -1
+5 -1
View File
@@ -167,7 +167,11 @@ static int process(jq_state *jq, jv value, int flags, int dumpopts) {
jv result;
while (jv_is_valid(result = jq_next(jq))) {
if ((options & RAW_OUTPUT) && jv_get_kind(result) == JV_KIND_STRING) {
fwrite(jv_string_value(result), 1, jv_string_length_bytes(jv_copy(result)), stdout);
if (options & ASCII_OUTPUT) {
jv_dumpf(result, stdout, JV_PRINT_ASCII);
} else {
fwrite(jv_string_value(result), 1, jv_string_length_bytes(jv_copy(result)), stdout);
}
ret = 0;
jv_free(result);
} else {