summary refs log tree commit diff
path: root/con.c
diff options
context:
space:
mode:
Diffstat (limited to 'con.c')
-rw-r--r--con.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/con.c b/con.c
index f00d379..f9dae8a 100644
--- a/con.c
+++ b/con.c
@@ -1,14 +1,18 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
-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;
 }