diff options
author | Karel Zak | 2016-02-19 16:43:28 +0100 |
---|---|---|
committer | Karel Zak | 2016-02-19 16:43:28 +0100 |
commit | 2981e0fd0e238f120811e1955e4f1bfddf93a326 (patch) | |
tree | 2f5fd9ceb4121ea4e35f096bc4575c9fc5291ea8 /libsmartcols/src/table.c | |
parent | libsmartcols: add scols_table_print_range() (diff) | |
download | kernel-qcow2-util-linux-2981e0fd0e238f120811e1955e4f1bfddf93a326.tar.gz kernel-qcow2-util-linux-2981e0fd0e238f120811e1955e4f1bfddf93a326.tar.xz kernel-qcow2-util-linux-2981e0fd0e238f120811e1955e4f1bfddf93a326.zip |
libsmartcols: support continuous printing
This patch allows to disable line-breaks. This feature is usable when
you want to re-print the same line more than once -- move terminal
cursor to the begin of the line and print again and again (aka
progress bar).
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r-- | libsmartcols/src/table.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c index fdbc7cd3f..cc19e4ab2 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -708,6 +708,27 @@ int scols_table_set_symbols(struct libscols_table *tb, } /** + * scols_table_enable_nolinesep + * @tb: table + * @enable: 1 or 0 + * + * Enable/disable line separator printing. This is usefull 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. + * + * Returns: 0 on success, negative number in case of an error. + */ +int scols_table_enable_nolinesep(struct libscols_table *tb, int enable) +{ + if (!tb) + return -EINVAL; + + DBG(TAB, ul_debugobj(tb, "nolinesep: %s", enable ? "ENABLE" : "DISABLE")); + tb->no_linesep = enable; + return 0; +} + +/** * scols_table_enable_colors: * @tb: table * @enable: 1 or 0 |