Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

actually, let's not reexport the termios stuff at the top level

  • Loading branch information...
commit 3e95a135f67b52589957c14595ad3837c7f2f1e5 1 parent 84dd024
@doy authored
View
13 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);
}
View
3  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;
View
15 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 }
}
View
4 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"),
};
}
View
2  test/termios2.rs
@@ -12,7 +12,7 @@ fn loop_chars () {
fn main () {
do term::ios::preserve {
- term::raw();
+ term::ios::raw();
loop_chars();
}
Please sign in to comment.
Something went wrong with that request. Please try again.