summaryrefslogtreecommitdiffstats
path: root/libsmartcols
diff options
context:
space:
mode:
authorKarel Zak2016-09-23 14:25:37 +0200
committerKarel Zak2016-09-23 14:25:37 +0200
commita3b91e82f269f4663d36b7878d0c430621415080 (patch)
tree7932306f343217bad45fa7e390b2e2e64fc34c19 /libsmartcols
parentlibsmartcols: cleanup scols_table_set_symbols() API (diff)
parentlibsmartcols: add scols_table_is_nolinesep() (diff)
downloadkernel-qcow2-util-linux-a3b91e82f269f4663d36b7878d0c430621415080.tar.gz
kernel-qcow2-util-linux-a3b91e82f269f4663d36b7878d0c430621415080.tar.xz
kernel-qcow2-util-linux-a3b91e82f269f4663d36b7878d0c430621415080.zip
Merge branch 'getters' of https://github.com/ignatenkobrain/util-linux
* 'getters' of https://github.com/ignatenkobrain/util-linux: libsmartcols: add scols_table_is_nolinesep() libsmartcols: add scols_table_is_nowrap() libsmartcols: add scols_table_get_name()
Diffstat (limited to 'libsmartcols')
-rw-r--r--libsmartcols/src/libsmartcols.h.in3
-rw-r--r--libsmartcols/src/libsmartcols.sym3
-rw-r--r--libsmartcols/src/table.c45
3 files changed, 48 insertions, 3 deletions
diff --git a/libsmartcols/src/libsmartcols.h.in b/libsmartcols/src/libsmartcols.h.in
index 02c691160..22cab64a1 100644
--- a/libsmartcols/src/libsmartcols.h.in
+++ b/libsmartcols/src/libsmartcols.h.in
@@ -195,6 +195,7 @@ extern struct libscols_line *scols_copy_line(const struct libscols_line *ln);
/* table */
extern int scols_table_colors_wanted(const struct libscols_table *tb);
extern int scols_table_set_name(struct libscols_table *tb, const char *name);
+extern const char *scols_table_get_name(const struct libscols_table *tb);
extern struct libscols_cell *scols_table_get_title(struct libscols_table *tb);
extern int scols_table_is_raw(const struct libscols_table *tb);
extern int scols_table_is_ascii(const struct libscols_table *tb);
@@ -203,6 +204,8 @@ extern int scols_table_is_noheadings(const struct libscols_table *tb);
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 62698bac6..aca648b63 100644
--- a/libsmartcols/src/libsmartcols.sym
+++ b/libsmartcols/src/libsmartcols.sym
@@ -147,4 +147,7 @@ global:
scols_table_set_default_symbols;
scols_table_set_termforce;
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 a433e42b4..759b54c27 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -130,6 +130,19 @@ int scols_table_set_name(struct libscols_table *tb, const char *str)
}
/**
+ * scols_table_get_name:
+ * @tb: a pointer to a struct libscols_table instance
+ *
+ * Returns: The current name setting of the table @tb
+ *
+ * Since: 2.29
+ */
+const char *scols_table_get_name(const struct libscols_table *tb)
+{
+ return tb->name;
+}
+
+/**
* scols_table_get_title:
* @tb: a pointer to a struct libscols_table instance
*
@@ -760,7 +773,7 @@ struct libscols_symbols *scols_table_get_symbols(const struct libscols_table *tb
}
/**
- * scols_table_enable_nolinesep
+ * scols_table_enable_nolinesep:
* @tb: table
* @enable: 1 or 0
*
@@ -776,11 +789,24 @@ 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
* @enable: 1 or 0
@@ -953,6 +979,19 @@ int scols_table_enable_nowrap(struct libscols_table *tb, int enable)
}
/**
+ * scols_table_is_nowrap:
+ * @tb: a pointer to a struct libscols_table instance
+ *
+ * Returns: 1 if nowrap is enabled.
+ *
+ * Since: 2.29
+ */
+int scols_table_is_nowrap(const struct libscols_table *tb)
+{
+ return tb->no_wrap;
+}
+
+/**
* scols_table_colors_wanted:
* @tb: table
*
@@ -967,7 +1006,7 @@ int scols_table_colors_wanted(const struct libscols_table *tb)
* scols_table_is_empty:
* @tb: table
*
- * Returns: 1 if the table is empty.
+ * Returns: 1 if the table is empty.
*/
int scols_table_is_empty(const struct libscols_table *tb)
{