summaryrefslogtreecommitdiffstats
path: root/src/term.rs
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-05-16 13:17:50 +0100
committerBen S <ogham@bsago.me>2015-05-16 13:17:50 +0100
commit2594690aff1f23e0dbb42576daed2788960bcbd7 (patch)
treeb1fd6b4143d4698d334deed3cdec808e04a7c102 /src/term.rs
parent00ae71850bc927833f55e602c35a8dcffbc4dfc6 (diff)
Start using the libc crate from crates.io
Diffstat (limited to 'src/term.rs')
-rw-r--r--src/term.rs17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/term.rs b/src/term.rs
index dc98cbe..a3ba130 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -1,19 +1,12 @@
mod c {
- #![allow(non_camel_case_types)]
- extern crate libc;
- pub use self::libc::{
- c_int,
- c_ushort,
- c_ulong,
- STDOUT_FILENO,
- };
+ pub use libc::{c_int, c_ushort, c_ulong, STDOUT_FILENO};
use std::mem::zeroed;
// Getting the terminal size is done using an ioctl command that
// takes the file handle to the terminal (which in our case is
// stdout), and populates a structure with the values.
- pub struct winsize {
+ pub struct Winsize {
pub ws_row: c_ushort,
pub ws_col: c_ushort,
}
@@ -30,9 +23,9 @@ mod c {
pub fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int;
}
- pub unsafe fn dimensions() -> winsize {
- let mut window: winsize = zeroed();
- ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut window as *mut winsize);
+ pub unsafe fn dimensions() -> Winsize {
+ let mut window: Winsize = zeroed();
+ ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut window as *mut Winsize);
window
}
}