[PATCH 1/2] lib/tt: make get_terminal_width available externally

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also, rename get_terminal_width() to tt_get_terminal_width()
to match naming convention of other exported functions.

Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx>
---
 include/tt.h |    1 +
 lib/tt.c     |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/tt.h b/include/tt.h
index 36d3bb2..9aa04db 100644
--- a/include/tt.h
+++ b/include/tt.h
@@ -86,5 +86,6 @@ extern struct tt_line *tt_add_line(struct tt *tb, struct tt_line *parent);
 
 extern int tt_line_set_data(struct tt_line *ln, int colnum, const char *data);
 extern int tt_line_set_userdata(struct tt_line *ln, void *data);
+extern int tt_get_terminal_width(void);
 
 #endif /* UTIL_LINUX_TT_H */
diff --git a/lib/tt.c b/lib/tt.c
index 1b5fbac..af3a34e 100644
--- a/lib/tt.c
+++ b/lib/tt.c
@@ -253,7 +253,7 @@ int tt_line_set_data(struct tt_line *ln, int colnum, const char *data)
 	return 0;
 }
 
-static int get_terminal_width(void)
+int tt_get_terminal_width(void)
 {
 #ifdef TIOCGSIZE
 	struct ttysize	t_win;
@@ -750,7 +750,7 @@ int tt_print_table(struct tt *tb)
 		return -1;
 
 	if (tb->first_run && !tb->termwidth) {
-		tb->termwidth = get_terminal_width();
+		tb->termwidth = tt_get_terminal_width();
 		if (tb->termwidth <= 0)
 			tb->termwidth = 80;
 	}
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux