summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarel Zak2012-11-22 14:32:21 +0100
committerKarel Zak2012-11-22 14:32:21 +0100
commit5f247c8bcd81a4d227051d22f35ea73a31e3616e (patch)
tree856bbde8766b693cc24237b5b978463b676e8e71 /lib
parentlib/ttyutils: create .c file (diff)
downloadkernel-qcow2-util-linux-5f247c8bcd81a4d227051d22f35ea73a31e3616e.tar.gz
kernel-qcow2-util-linux-5f247c8bcd81a4d227051d22f35ea73a31e3616e.tar.xz
kernel-qcow2-util-linux-5f247c8bcd81a4d227051d22f35ea73a31e3616e.zip
lib/ttyutils: add test program
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Makemodule.am5
-rw-r--r--lib/ttyutils.c9
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/Makemodule.am b/lib/Makemodule.am
index 59f89e93e..806f9e5b0 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -52,6 +52,7 @@ check_PROGRAMS += \
test_randutils \
test_strutils \
test_tt \
+ test_ttyutils \
test_wholedisk
if LINUX
@@ -65,6 +66,10 @@ check_PROGRAMS += \
test_pager
endif
+test_ttyutils_SOURCES = lib/ttyutils.c
+test_ttyutils_CFLAGS = -DTEST_PROGRAM
+test_ttyutils_LDADD = libcommon.la
+
test_blkdev_SOURCES = lib/blkdev.c
test_blkdev_CFLAGS = -DTEST_PROGRAM
test_blkdev_LDADD = libcommon.la
diff --git a/lib/ttyutils.c b/lib/ttyutils.c
index d37c168ae..39d0516ca 100644
--- a/lib/ttyutils.c
+++ b/lib/ttyutils.c
@@ -37,3 +37,12 @@ int get_terminal_width(void)
return 0;
}
+#ifdef TEST_PROGRAM
+# include <stdlib.h>
+
+int main(void)
+{
+ fprintf(stderr, "tty width: %d\n", get_terminal_width());
+ return EXIT_SUCCESS;
+}
+#endif