From 5f247c8bcd81a4d227051d22f35ea73a31e3616e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 22 Nov 2012 14:32:21 +0100 Subject: [PATCH] lib/ttyutils: add test program Signed-off-by: Karel Zak --- lib/Makemodule.am | 5 +++++ lib/ttyutils.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/Makemodule.am b/lib/Makemodule.am index 59f89e93e4..806f9e5b08 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 d37c168ae0..39d0516ca5 100644 --- a/lib/ttyutils.c +++ b/lib/ttyutils.c @@ -37,3 +37,12 @@ int get_terminal_width(void) return 0; } +#ifdef TEST_PROGRAM +# include + +int main(void) +{ + fprintf(stderr, "tty width: %d\n", get_terminal_width()); + return EXIT_SUCCESS; +} +#endif -- 2.47.2