diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-04-03 02:43:29 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-04-03 02:46:18 -0500 |
commit | 3e95a135f67b52589957c14595ad3837c7f2f1e5 (patch) | |
tree | cc39a9f97ada9bf4c82b685c055ef6bd29e98475 /src | |
parent | 84dd024e5a6175ff5e18c7a8338f468d5f16944f (diff) | |
download | rust-term-3e95a135f67b52589957c14595ad3837c7f2f1e5.tar.gz rust-term-3e95a135f67b52589957c14595ad3837c7f2f1e5.zip |
actually, let's not reexport the termios stuff at the top level
Diffstat (limited to 'src')
-rw-r--r-- | src/ios.rs | 13 | ||||
-rw-r--r-- | src/term.rs | 3 | ||||
-rw-r--r-- | src/util.rs | 15 |
3 files changed, 16 insertions, 15 deletions
@@ -1,4 +1,4 @@ -use core::libc::{c_int,c_uint,c_void}; +use core::libc::{c_int,c_void}; use util::guard; pub fn cooked () -> int { @@ -24,15 +24,6 @@ pub fn preserve<T> (body: &fn () -> T) -> T { } } -pub fn size() -> (uint, uint) { - let cols: c_uint = 0; - let rows: c_uint = 0; - unsafe { - c::size(&cols, &rows) - } - (cols as uint, rows as uint) -} - #[link_name = "termios_wrapper"] extern mod c { fn cooked () -> c_int; @@ -42,6 +33,4 @@ extern mod c { fn get() -> *c_void; fn set(t: *c_void); - - fn size(cols: *c_uint, rows: *c_uint); } diff --git a/src/term.rs b/src/term.rs index b8ce18e..e876dfa 100644 --- a/src/term.rs +++ b/src/term.rs @@ -5,8 +5,7 @@ #[crate_type = "lib"]; -pub use ios::{cooked,cbreak,raw,echo,size}; -pub use util::isatty; +pub use util::{isatty,size}; pub mod hexes; pub mod info; diff --git a/src/util.rs b/src/util.rs index 43a1a69..1a4e1c3 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,4 +1,4 @@ -use core::libc::c_int; +use core::libc::{c_int,c_uint}; pub fn guard<T> (finally: ~fn (), body: &fn () -> T) -> T { let _guard = Guard { finally: finally }; @@ -40,6 +40,19 @@ extern mod io_helper { fn timed_read (timeout: c_int) -> c_int; } +pub fn size() -> (uint, uint) { + let cols: c_uint = 0; + let rows: c_uint = 0; + unsafe { + termios_wrapper::size(&cols, &rows) + } + (cols as uint, rows as uint) +} + +extern mod termios_wrapper { + fn size(cols: *c_uint, rows: *c_uint); +} + pub fn isatty() -> bool { unsafe { c_isatty(0) as bool } } |