summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/symbols.c
diff options
context:
space:
mode:
authorKarel Zak2016-09-07 11:07:04 +0200
committerKarel Zak2016-09-07 11:07:04 +0200
commit64ce7cbbc0a43010d97e333cc56b31e3218ab646 (patch)
tree2edc10509c8398fdfd4838952efadc59e1721888 /libsmartcols/src/symbols.c
parentfsck: remove fs-specific options from man page (diff)
downloadkernel-qcow2-util-linux-64ce7cbbc0a43010d97e333cc56b31e3218ab646.tar.gz
kernel-qcow2-util-linux-64ce7cbbc0a43010d97e333cc56b31e3218ab646.tar.xz
kernel-qcow2-util-linux-64ce7cbbc0a43010d97e333cc56b31e3218ab646.zip
libsmartcols: allow to change cell padding char
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/symbols.c')
-rw-r--r--libsmartcols/src/symbols.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libsmartcols/src/symbols.c b/libsmartcols/src/symbols.c
index df31f454c..d2f7a71ba 100644
--- a/libsmartcols/src/symbols.c
+++ b/libsmartcols/src/symbols.c
@@ -106,7 +106,7 @@ int scols_symbols_set_right(struct libscols_symbols *sb, const char *str)
/**
* scols_symbols_set_title_padding:
* @sb: a pointer to a struct libscols_symbols instance
- * @str: a string which will represent the symbols which wraps title output
+ * @str: a string which will represent the symbols which fill title output
*
* The current implementation uses only the first byte from the padding string.
* A multibyte chars are not supported yet.
@@ -121,6 +121,22 @@ int scols_symbols_set_title_padding(struct libscols_symbols *sb, const char *str
}
/**
+ * scols_symbols_set_cell_padding:
+ * @sb: a pointer to a struct libscols_symbols instance
+ * @str: a string which will represent the symbols which fill cells
+ *
+ * The padding char has to take up just one cell on the terminal.
+ *
+ * Returns: 0, a negative value in case of an error.
+ *
+ * Since: 2.29
+ */
+int scols_symbols_set_cell_padding(struct libscols_symbols *sb, const char *str)
+{
+ return strdup_to_struct_member(sb, cell_padding, str);
+}
+
+/**
* scols_copy_symbols:
* @sb: a pointer to a struct libscols_symbols instance
*
@@ -147,6 +163,8 @@ struct libscols_symbols *scols_copy_symbols(const struct libscols_symbols *sb)
if (!rc)
rc = scols_symbols_set_title_padding(ret, sb->title_padding);
if (!rc)
+ rc = scols_symbols_set_cell_padding(ret, sb->cell_padding);
+ if (!rc)
return ret;
scols_unref_symbols(ret);