diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-03-20 00:09:10 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-03-20 00:09:10 -0500 |
commit | 28eeecd93029db4b756844852e3608eba83bf455 (patch) | |
tree | 750691848cf968d0e9533f17bb29d523b238017b /src/ios.rs | |
parent | d2a8e7df2deb31f87470511f8fb3e0d0ad48fde6 (diff) | |
download | rust-term-28eeecd93029db4b756844852e3608eba83bf455.tar.gz rust-term-28eeecd93029db4b756844852e3608eba83bf455.zip |
rearrange things a bit
Diffstat (limited to 'src/ios.rs')
-rw-r--r-- | src/ios.rs | 50 |
1 files changed, 25 insertions, 25 deletions
@@ -1,5 +1,30 @@ use core::libc::c_int; +pub fn cooked () -> int { + unsafe { c::cooked() as int } +} + +pub fn cbreak () -> int { + unsafe { c::cbreak() as int } +} + +pub fn raw () -> int { + unsafe { c::raw() as int } +} + +pub fn echo (enable: bool) -> int { + unsafe { c::echo(enable as c_int) as int } +} + +pub fn preserve<T> (body: &fn () -> T) -> T { + let _guard = PreserveTermios(); + body() +} + +pub fn isatty() -> bool { + unsafe { c_isatty(0) as bool } +} + enum struct_termios {} struct PreserveTermios { @@ -31,28 +56,3 @@ extern { #[link_name = "isatty"] fn c_isatty(fd: c_int) -> c_int; } - -pub fn cooked () -> int { - unsafe { c::cooked() as int } -} - -pub fn cbreak () -> int { - unsafe { c::cbreak() as int } -} - -pub fn raw () -> int { - unsafe { c::raw() as int } -} - -pub fn echo (enable: bool) -> int { - unsafe { c::echo(enable as c_int) as int } -} - -pub fn preserve<T> (body: &fn () -> T) -> T { - let _guard = PreserveTermios(); - body() -} - -pub fn isatty() -> bool { - unsafe { c_isatty(0) as bool } -} |