mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
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:
committed by
Jan Höppner
parent
b165500b69
commit
58189b8786
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user