]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: improve JSON
authorKarel Zak <kzak@redhat.com>
Fri, 16 Sep 2016 11:22:47 +0000 (13:22 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 16 Sep 2016 11:22:47 +0000 (13:22 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/table.c
libsmartcols/src/table_print.c

index 6a0f8303d901a1f9d1dce528bae564272b8adc56..c0cf24636f57f6e62f5d1444abdf0b6e15209368 100644 (file)
@@ -725,7 +725,7 @@ int scols_table_set_symbols(struct libscols_table *tb,
  *
  * Enable/disable line separator printing. This is useful if you want to
  * re-printing the same line more than once (e.g. progress bar). Don't use it
- * if you're not sure. This option may be ignored for JSON output.
+ * if you're not sure.
  *
  * Returns: 0 on success, negative number in case of an error.
  */
index e8a4aa361526268c9ac4aaf0a209ca8ce32a2295..41b56d1d64aff8c68bea2e7b8ac45ee9aad7f0d0 100644 (file)
@@ -684,7 +684,8 @@ static void fput_line_close(struct libscols_table *tb, int last, int last_in_tab
                if (tb->indent_last_sep)
                        fput_indent(tb);
                fputs(last ? "}" : "},", tb->out);
-               fputs(linesep(tb), tb->out);
+               if (!tb->no_linesep)
+                       fputs(linesep(tb), tb->out);
 
        } else if (tb->no_linesep == 0 && last_in_table == 0)
                fputs(linesep(tb), tb->out);