blob: f9dae8a75d5e655428e51aa268f58c682a35f620 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include <sys/ioctl.h>
#include <unistd.h>
#include "con.h"
struct consz con_size(void) {
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
return (struct consz) { w.ws_row, w.ws_col };
}
unsigned con_rows(void) {
return con_size().rows;
}
unsigned con_cols(void) {
return con_size().cols;
}
|