summaryrefslogtreecommitdiff
path: root/libterm/term.c
blob: 5d2a44f0a49b70bcc28d1b6f4acab67c2394fcc3 (plain) (blame)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "term.h"

int term_init_data( term_screen *term )
{
	int ret=0;

	term->term_col = term_get_col();
	if (term->term_col == -1) ret = -1;

	term->term_row = term_get_row();
	if (term->term_row == -1) ret = -1;

	term->mode = SCREEN_MODE_80x24;

	return ret;
}


int term_get_col(  )
{
	int ret=-1;
	int fret=-1;

	struct winsize w;
	
	
	fret = ioctl(0, TIOCGWINSZ, &w );
	if ( fret == 0 )
	{
		return w.ws_col;
	}
	

	return -1;
}


int term_get_row(  )
{
	int ret=-1;
	int fret=-1;

	struct winsize w;
	
	
	fret = ioctl(0, TIOCGWINSZ, &w );
	if ( fret == 0 )
	{
		return w.ws_row;
	}
	
	return -1;
}