aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-04-03 02:43:29 -0500
committerJesse Luehrs <doy@tozt.net>2013-04-03 02:46:18 -0500
commit3e95a135f67b52589957c14595ad3837c7f2f1e5 (patch)
treecc39a9f97ada9bf4c82b685c055ef6bd29e98475
parent84dd024e5a6175ff5e18c7a8338f468d5f16944f (diff)
downloadrust-term-3e95a135f67b52589957c14595ad3837c7f2f1e5.tar.gz
rust-term-3e95a135f67b52589957c14595ad3837c7f2f1e5.zip
actually, let's not reexport the termios stuff at the top level
-rw-r--r--src/ios.rs13
-rw-r--r--src/term.rs3
-rw-r--r--src/util.rs15
-rw-r--r--test/termios.rs4
-rw-r--r--test/termios2.rs2
5 files changed, 19 insertions, 18 deletions
diff --git a/src/ios.rs b/src/ios.rs
index 168d3a0..502b31e 100644
--- a/src/ios.rs
+++ b/src/ios.rs
@@ -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 }
}
diff --git a/test/termios.rs b/test/termios.rs
index 7552373..3683cee 100644
--- a/test/termios.rs
+++ b/test/termios.rs
@@ -2,8 +2,8 @@ extern mod term;
fn main () {
match os::args()[1] {
- ~"echo" => term::echo(true),
- ~"noecho" => term::echo(false),
+ ~"echo" => term::ios::echo(true),
+ ~"noecho" => term::ios::echo(false),
_ => fail!(~"unknown argument"),
};
}
diff --git a/test/termios2.rs b/test/termios2.rs
index 35986b2..a7b3aa9 100644
--- a/test/termios2.rs
+++ b/test/termios2.rs
@@ -12,7 +12,7 @@ fn loop_chars () {
fn main () {
do term::ios::preserve {
- term::raw();
+ term::ios::raw();
loop_chars();
}