blob: 364dae61936651f474cf5312a1b6d4f1641b05c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <asm-generic/ioctls.h>
#include <syscall.h>
#include <termios.h>
struct __winsize {
unsigned short ws_row;
unsigned short ws_col;
unsigned short ws_xpixel;
unsigned short ws_ypixel;
};
int tcgetwinsize(int fildes, struct winsize *winsize_p)
{
long ret;
struct __winsize winsize = { 0 };
ret = syscall(ioctl, fildes, TIOCGWINSZ, &winsize);
winsize_p->ws_row = winsize.ws_row;
winsize_p->ws_col = winsize.ws_col;
return ret;
}
|