summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarel Zak2013-11-22 13:31:15 +0100
committerKarel Zak2014-03-11 11:35:12 +0100
commit575a1de03a38bdcc9c9697041633732ea34f1021 (patch)
tree55a5b532e49a3f19cd9efc2f6f4defa773f6067e /lib
parentlib/tt: don't hardcode stdout as output (diff)
downloadkernel-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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/tt.c b/lib/tt.c
index 46fc00e87..e94524e86 100644
--- a/lib/tt.c
+++ b/lib/tt.c
@@ -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)