aboutsummaryrefslogtreecommitdiffstats
path: root/src/ios.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ios.rs')
-rw-r--r--src/ios.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ios.rs b/src/ios.rs
index f8b464a..2e5bd17 100644
--- a/src/ios.rs
+++ b/src/ios.rs
@@ -1,11 +1,30 @@
use core::libc::c_int;
+enum struct_termios {}
+
+pub struct PreserveTermios {
+ priv state: *struct_termios,
+}
+
+pub fn PreserveTermios () -> ~PreserveTermios {
+ ~PreserveTermios { state: unsafe { c::get() } }
+}
+
+impl Drop for PreserveTermios {
+ fn finalize (&self) {
+ unsafe { c::set(self.state) }
+ }
+}
+
#[link_name = "termios_wrapper"]
extern mod c {
fn cooked () -> c_int;
fn cbreak () -> c_int;
fn raw () -> c_int;
fn echo (enable: c_int) -> c_int;
+
+ fn get() -> *struct_termios;
+ fn set(t: *struct_termios);
}
pub fn cooked () -> bool {