summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/column.c
diff options
context:
space:
mode:
authorKarel Zak2016-09-06 10:51:25 +0200
committerKarel Zak2016-09-06 10:51:25 +0200
commitff471d89a12eef331de8e66c33cd9a2c0e23984e (patch)
tree9f2e92f090eb3c6b9ef442abbdd74a75a7776a0d /libsmartcols/src/column.c
parentlib/randutils: add xsrand() and rand_get_number() (diff)
downloadkernel-qcow2-util-linux-ff471d89a12eef331de8e66c33cd9a2c0e23984e.tar.gz
kernel-qcow2-util-linux-ff471d89a12eef331de8e66c33cd9a2c0e23984e.tar.xz
kernel-qcow2-util-linux-ff471d89a12eef331de8e66c33cd9a2c0e23984e.zip
libsmartcols: support multi-line cells based on line breaks
Now libsmartcols completely control when and how wrap long lines/cells. This is sometimes user unfriendly and it would be nice to support multi-line cells where wrap is based on \n (new line char). This patch add new column flag SCOLS_FL_WRAPNL. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/column.c')
-rw-r--r--libsmartcols/src/column.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c
index a49d3de5c..3d4017fdc 100644
--- a/libsmartcols/src/column.c
+++ b/libsmartcols/src/column.c
@@ -356,3 +356,19 @@ int scols_column_is_wrap(struct libscols_column *cl)
return -EINVAL;
return cl->flags & SCOLS_FL_WRAP;
}
+/**
+ * scols_column_is_wrapnl:
+ * @cl: a pointer to a struct libscols_column instance
+ *
+ * Gets the value of @cl's flag wrap.
+ *
+ * Returns: wrapnl flag value, negative value in case of an error.
+ *
+ * Since: 2.29
+ */
+int scols_column_is_wrapnl(struct libscols_column *cl)
+{
+ if (!cl)
+ return -EINVAL;
+ return cl->flags & SCOLS_FL_WRAPNL;
+}