From 43e06c67f9a03114fa616a529faee6ed8eb26e97 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 23 Sep 2016 14:21:15 +0200 Subject: [PATCH] libsmartcols: add scols_table_is_nolinesep() And save 1 or 0 into tb->no_linesep instead of any value. Signed-off-by: Igor Gnatenko --- libsmartcols/src/libsmartcols.h.in | 1 + libsmartcols/src/libsmartcols.sym | 1 + libsmartcols/src/table.c | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in index 6df878804..0fa9b464d 100644 --- a/libsmartcols/src/libsmartcols.h.in +++ b/libsmartcols/src/libsmartcols.h.in @@ -205,6 +205,7 @@ extern int scols_table_is_empty(const struct libscols_table *tb); extern int scols_table_is_export(const struct libscols_table *tb); extern int scols_table_is_maxout(const struct libscols_table *tb); extern int scols_table_is_nowrap(const struct libscols_table *tb); +extern int scols_table_is_nolinesep(const struct libscols_table *tb); extern int scols_table_is_tree(const struct libscols_table *tb); extern int scols_table_enable_colors(struct libscols_table *tb, int enable); diff --git a/libsmartcols/src/libsmartcols.sym b/libsmartcols/src/libsmartcols.sym index 75ae718a0..774d84fe0 100644 --- a/libsmartcols/src/libsmartcols.sym +++ b/libsmartcols/src/libsmartcols.sym @@ -147,4 +147,5 @@ global: scols_table_set_termwidth; scols_table_get_name; scols_table_is_nowrap; + scols_table_is_nolinesep; } SMARTCOLS_2.28; diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c index 096730516..3b0424704 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -729,7 +729,7 @@ int scols_table_set_symbols(struct libscols_table *tb, } /** - * scols_table_enable_nolinesep + * scols_table_enable_nolinesep: * @tb: table * @enable: 1 or 0 * @@ -745,10 +745,23 @@ int scols_table_enable_nolinesep(struct libscols_table *tb, int enable) return -EINVAL; DBG(TAB, ul_debugobj(tb, "nolinesep: %s", enable ? "ENABLE" : "DISABLE")); - tb->no_linesep = enable; + tb->no_linesep = enable ? 1 : 0; return 0; } +/** + * scols_table_is_nolinesep: + * @tb: a pointer to a struct libscols_table instance + * + * Returns: 1 if line separator printing is disabled. + * + * Since: 2.29 + */ +int scols_table_is_nolinesep(const struct libscols_table *tb) +{ + return tb->no_linesep; +} + /** * scols_table_enable_colors: * @tb: table