diff options
author | Karel Zak | 2013-11-22 13:31:15 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-11 11:35:12 +0100 |
commit | 575a1de03a38bdcc9c9697041633732ea34f1021 (patch) | |
tree | 55a5b532e49a3f19cd9efc2f6f4defa773f6067e /lib | |
parent | lib/tt: don't hardcode stdout as output (diff) | |
download | kernel-qcow2-util-linux-575a1de03a38bdcc9c9697041633732ea34f1021.tar.gz kernel-qcow2-util-linux-575a1de03a38bdcc9c9697041633732ea34f1021.tar.xz kernel-qcow2-util-linux-575a1de03a38bdcc9c9697041633732ea34f1021.zip |
lib/tt: add tb_get_nlines()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tt.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -223,6 +223,19 @@ void tt_set_stream(struct tt *tb, FILE *out) tb->out = out; } +size_t tb_get_nlines(struct tt *tb) +{ + struct list_head *p; + size_t ct = 0; + + if (tt_is_empty(tb)) + return 0; + + list_for_each(p, &tb->tb_lines) + ct++; + return ct; +} + void tt_remove_lines(struct tt *tb) { if (!tb) |