From: Igor Gnatenko Date: Fri, 23 Sep 2016 12:21:15 +0000 (+0200) Subject: libsmartcols: add scols_table_is_nolinesep() X-Git-Tag: v2.29-rc1~27^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43e06c67f9a03114fa616a529faee6ed8eb26e97;p=thirdparty%2Futil-linux.git libsmartcols: add scols_table_is_nolinesep() And save 1 or 0 into tb->no_linesep instead of any value. Signed-off-by: Igor Gnatenko --- diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in index 6df8788047..0fa9b464de 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 75ae718a03..774d84fe09 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 0967305165..3b04247047 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