libutil: Add indention and separator to util_rec_example.c

Show how to use util_rec_set_indent() and util_rec_print_separator()
in util_rec_example.c

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2018-12-06 15:06:37 +01:00
committed by Jan Höppner
parent b165500b69
commit 58189b8786

View File

@@ -42,6 +42,8 @@ static void print_records(const char *format, struct util_rec *rec)
/* Print the record */
util_rec_print(rec);
}
/* Print a separator line (is a nop for long and csv format) */
util_rec_print_separator(rec);
printf("\n");
}
@@ -72,6 +74,11 @@ int main(void)
print_records("Wide format", rec);
util_rec_free(rec);
rec = util_rec_new_wide("-");
util_rec_set_indent(rec, 4);
print_records("Wide format with indentation", rec);
util_rec_free(rec);
rec = util_rec_new_long("-", ":", "number", 30, 20);
print_records("Long format", rec);
util_rec_free(rec);