summary refs log tree commit diff
path: root/con.c
diff options
context:
space:
mode:
authorwrmr2024-11-09 01:51:42 -0500
committerwrmr2024-11-09 01:51:42 -0500
commitcbb9f606333774f4de6f639891cd1411419ecf2a (patch)
tree9b75436effccbcd065c32f207f93fce051c64982 /con.c
parent9ac1ca968081bcb826cf9ee70666bc44983d087f (diff)
use actual console size for nav_lines(), instead of dummy value
Diffstat (limited to 'con.c')
-rw-r--r--con.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/con.c b/con.c
new file mode 100644
index 0000000..f00d379
--- /dev/null
+++ b/con.c
@@ -0,0 +1,14 @@
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+unsigned con_lines(void) {
+	struct winsize w;
+	ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
+	return w.ws_row;
+}
+
+unsigned con_cols(void) {
+	struct winsize w;
+	ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
+	return w.ws_col;
+}