blob: 9fdf9a4adf8920e3845d9f2bba5a9eac4d9219cc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
use libc::{c_int, winsize};
pub fn size() -> Option<winsize> {
let mut window: winsize = winsize {
ws_row: 0,
ws_col: 0,
ws_xpixel: 0,
ws_ypixel: 0,
};
let result: c_int;
unsafe {
result = libc::ioctl(0, libc::TIOCGWINSZ, &mut window);
}
if result < 0 {
return None;
}
return Some(window);
}
|