From 58189b878697fef3bf405fdd864bf40f2149ccc0 Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Thu, 6 Dec 2018 15:06:37 +0100 Subject: [PATCH] libutil: Add indention and separator to util_rec_example.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show how to use util_rec_set_indent() and util_rec_print_separator() in util_rec_example.c Signed-off-by: Ingo Franzki Signed-off-by: Jan Höppner --- libutil/util_rec_example.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libutil/util_rec_example.c b/libutil/util_rec_example.c index bc38bb44..801f9099 100644 --- a/libutil/util_rec_example.c +++ b/libutil/util_rec_example.c @@ -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);