From 3f54d883edc90d0e6419210eff6be8125ba89daf Mon Sep 17 00:00:00 2001 From: wrmr Date: Sat, 9 Nov 2024 16:11:39 -0500 Subject: rename con_lines -> con_rows, add con_size --- con.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'con.c') diff --git a/con.c b/con.c index f00d379..f9dae8a 100644 --- a/con.c +++ b/con.c @@ -1,14 +1,18 @@ #include #include -unsigned con_lines(void) { +#include "con.h" + +struct consz con_size(void) { struct winsize w; ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); - return w.ws_row; + return (struct consz) { w.ws_row, w.ws_col }; +} + +unsigned con_rows(void) { + return con_size().rows; } unsigned con_cols(void) { - struct winsize w; - ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); - return w.ws_col; + return con_size().cols; } -- cgit 1.4.1-2-gfad0