treesummaryrefslogcommitdiff
path: root/termsize.c
blob: 83a0158d4a881f3e962de5f21c27f72440fbc394 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>

int main (int argc, char **argv)
{
    struct winsize w;
    ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);

    printf ("lines %d\n", w.ws_row);
    printf ("columns %d\n", w.ws_col);
    return 0;  // make sure your main returns int
}