static void finalize_output(struct wipe_control *ctl)
{
- if (ctl->parsable && !ctl->no_headings
- && !scols_table_is_empty(ctl->outtab)) {
- struct libscols_iter *itr = scols_new_iter(SCOLS_ITER_FORWARD);
- struct libscols_column *cl;
- int i = 0;
-
- if (!itr)
- err_oom();
-
- fputs("# ", stdout);
- while (scols_table_next_column(ctl->outtab, itr, &cl) == 0) {
- struct libscols_cell *hdr = scols_column_get_header(cl);
- const char *name = scols_cell_get_data(hdr);
-
- if (i)
- fputc(',', stdout);
- fputs(name, stdout);
- i++;
- }
- fputc('\n', stdout);
- scols_free_iter(itr);
- }
scols_print_table(ctl->outtab);
scols_unref_table(ctl->outtab);
}