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 @@ -129,6 +129,19 @@ int scols_table_set_name(struct libscols_table *tb, const char *str) return strdup_to_struct_member(tb, name, 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,10 +789,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 @@ -952,6 +978,19 @@ int scols_table_enable_nowrap(struct libscols_table *tb, int enable) return 0; } +/** + * 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) {