]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: add scols_table_is_nolinesep()
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>
Fri, 23 Sep 2016 12:21:15 +0000 (14:21 +0200)
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>
Fri, 23 Sep 2016 12:21:15 +0000 (14:21 +0200)
And save 1 or 0 into tb->no_linesep instead of any value.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
libsmartcols/src/libsmartcols.h.in
libsmartcols/src/libsmartcols.sym
libsmartcols/src/table.c

index 6df8788047fd9ba024e5dd152f5a52782f316d94..0fa9b464deef67d9d8da48e57a2250227589b1d3 100644 (file)
@@ -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);
index 75ae718a03c4821484268f41c63669197bd62118..774d84fe095f15e4b9883022622bb6f5c77cfd1b 100644 (file)
@@ -147,4 +147,5 @@ global:
        scols_table_set_termwidth;
        scols_table_get_name;
        scols_table_is_nowrap;
+       scols_table_is_nolinesep;
 } SMARTCOLS_2.28;
index 09673051650a428394e37d9a1b53b38efce8f9ac..3b04247047225e4a4e21467d3eb50fd2bc32a5a0 100644 (file)
@@ -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