diff options
author | Karel Zak | 2014-03-19 16:58:15 +0100 |
---|---|---|
committer | Karel Zak | 2014-04-03 12:29:16 +0200 |
commit | 571441e29198db3c90ec93f44663c77dfcbab002 (patch) | |
tree | 9ddb122b4958aa305ba8e2b04caf067ec727dec3 /libsmartcols/src/table.c | |
parent | libsmartcols: add test (diff) | |
download | kernel-qcow2-util-linux-571441e29198db3c90ec93f44663c77dfcbab002.tar.gz kernel-qcow2-util-linux-571441e29198db3c90ec93f44663c77dfcbab002.tar.xz kernel-qcow2-util-linux-571441e29198db3c90ec93f44663c77dfcbab002.zip |
libsmartcols: support alternative streams
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r-- | libsmartcols/src/table.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c index e703f8f26..5c45aeeeb 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -47,6 +47,7 @@ struct libscols_table *scols_new_table(int flags, struct libscols_symbols *syms) tb->flags = flags; tb->refcount = 1; tb->first_run = TRUE; + tb->out = stdout; INIT_LIST_HEAD(&tb->tb_lines); INIT_LIST_HEAD(&tb->tb_columns); @@ -253,6 +254,22 @@ int scols_table_get_flags(struct libscols_table *tb) return tb ? tb->flags: -EINVAL; } +int scols_table_set_stream(struct libscols_table *tb, FILE *stream) +{ + assert(tb); + if (!tb) + return -EINVAL; + + tb->out = stream; + return 0; +} + +FILE *scols_table_get_stream(struct libscols_table *tb) +{ + assert(tb); + return tb ? tb->out: NULL; +} + /* * @tb: table * @: number of column (0..N) |