Subversion Repositories planix.SVN

Rev

Rev 118 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 118 Rev 119
Line 26... Line 26...
26
	atexit(disable_raw);
26
	atexit(disable_raw);
27
	struct termios	raw = orig_termios;
27
	struct termios	raw = orig_termios;
28
	raw.c_iflag &= ~(IXON);
28
	raw.c_iflag &= ~(IXON);
29
	raw.c_lflag &= ~(ECHO | ICANON | ISIG);
29
	raw.c_lflag &= ~(ECHO | ICANON | ISIG);
30
	tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
30
	tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
-
 
31
}
-
 
32
 
-
 
33
#include <stdio.h>
-
 
34
 
-
 
35
 
-
 
36
void 
-
 
37
get_size(short *columns, short *lines)
-
 
38
{
-
 
39
	struct winsize win;
-
 
40
	int x,y;
-
 
41
	if (ioctl(0, TIOCGWINSZ, &win) < 0) {
-
 
42
		*lines = tgetnum("li");
-
 
43
		*columns = tgetnum("co");
-
 
44
		return;
-
 
45
	} 
-
 
46
 
-
 
47
	*lines = win.ws_row;	
-
 
48
	*columns = win.ws_col;	
-
 
49
 
-
 
50
 
-
 
51
	printf("Here is the terminal size: %d x %d\n", *columns, *lines );
-
 
52
	/*	
-
 
53
	
-
 
54
	
-
 
55
	else {
-
 
56
		if ((LINES = winsz.ws_row = win.ws_row) == 0)
-
 
57
			LINES = tgetnum("li");
-
 
58
		i = LINES;
-
 
59
		if ((COLUMNS = winsz.ws_col = win.ws_col) == 0)
-
 
60
			COLUMNS = tgetnum("co");
-
 
61
	}
-
 
62
*/
-
 
63
 
31
}
64
}