use libc::{c_int, winsize}; pub fn size() -> Option { 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(1, libc::TIOCGWINSZ, &mut window); } if result < 0 { return None; } return Some(window); }