aboutsummaryrefslogtreecommitdiff
path: root/lib/tctl/tctl.c
blob: 187d1a9d3cb95d7074f87fa6f7e85400f1f68dce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "tctl.h"
#include "../sys/ioctl.h"

#define GET_WIN_SIZE 0x5413
#define SET_WIN_SIZE 0x5414
#define TC_GET_ATTR  0x5401

window_size_t tctl_get_window_size()
{
	window_size_t ws;
	ioctl(1, GET_WIN_SIZE, &ws);
	return ws;
}


void tctl_set_window_size(window_size_t size)
{
	ioctl(1, SET_WIN_SIZE, &size);
}


int isatty()
{
	termios_t term;
	return ioctl(1, TC_GET_ATTR, &term) == 0;
}