toaruos/userspace/util/term_size.c
2013-03-25 22:24:26 -07:00

13 lines
254 B
C

#include <stdio.h>
#include <sys/ioctl.h>
#include <termios.h>
int main(int argc, char * argv[]) {
struct winsize w;
int width, height;
ioctl(0, TIOCGWINSZ, &w);
width = w.ws_col;
height = w.ws_row;
printf("Terminal is %dx%d\n", width, height);
}