libite
Functions
conio.c File Reference
#include <poll.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
Include dependency graph for conio.c:

Functions

void initscr (int *row, int *col)
 Probe terminal size. More...
 

Detailed Description

Author
Joachim Wiberg
Date
2009-2021

Function Documentation

◆ initscr()

void initscr ( int *  row,
int *  col 
)

Probe terminal size.

Parameters
rowpointer to integer to store number of rows
colpointer 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.