libsmartcols: add scols_table_is_nolinesep()

And save 1 or 0 into tb->no_linesep instead of any value.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Igor Gnatenko 2016-09-23 14:21:15 +02:00
parent 8427c2ec9c
commit 43e06c67f9
3 changed files with 17 additions and 2 deletions

View 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);

View 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;

View 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