libite
|
#include <poll.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
Functions | |
void | initscr (int *row, int *col) |
Probe terminal size. More... | |
void initscr | ( | int * | row, |
int * | col | ||
) |
Probe terminal size.
row | pointer to integer to store number of rows |
col | pointer to integer to store number of columns |
This function checks if stdin and stdout isatty() and then sets the TTY in raw mode to silently ask the size using ANSI escape sequences. This is achieved by trying to go to corner 999,999 followed by querying the cursor position. Afterwards the TTY is returned to the state if was before, e.g. cooked. The number of rows and columns is returned in the input arguments to this function.
If stdio is not a TTY, then a default 24x80 is returned.