aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-04-03 19:40:58 -0500
committerJesse Luehrs <doy@tozt.net>2013-04-03 19:40:58 -0500
commit1b777bfb7cd9e40982b92a58c3e57d94f66ae796 (patch)
tree1ce4e2343fb90a1f3e54013e9a4a38a8ecb747fc
parent0524d8d9b7588b1f89306f495ebfcba5a4a79f47 (diff)
downloadrust-term-1b777bfb7cd9e40982b92a58c3e57d94f66ae796.tar.gz
rust-term-1b777bfb7cd9e40982b92a58c3e57d94f66ae796.zip
document term::ios
-rw-r--r--src/ios.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ios.rs b/src/ios.rs
index 95f798f..f1e6e80 100644
--- a/src/ios.rs
+++ b/src/ios.rs
@@ -1,22 +1,49 @@
use core::libc::{c_int,c_void};
use guard::guard;
+/**
+ * Put the terminal into cooked mode.
+ *
+ * This is the normal line-buffered mode.
+ */
pub fn cooked () -> int {
unsafe { c::cooked() as int }
}
+/**
+ * Put the terminal into cbreak mode.
+ *
+ * This is the normal unbuffered mode.
+ */
pub fn cbreak () -> int {
unsafe { c::cbreak() as int }
}
+/**
+ * Put the terminal into raw mode.
+ *
+ * This is like cbreak mode, except that control characters (like ^C) are not
+ * translated into signals.
+ */
pub fn raw () -> int {
unsafe { c::raw() as int }
}
+/**
+ * Change the echo mode of the terminal.
+ *
+ * `true` turns echo on, and `false` turns echo off.
+ */
pub fn echo (enable: bool) -> int {
unsafe { c::echo(enable as c_int) as int }
}
+/**
+ * Run a block of code, restoring the terminal state when the block ends.
+ *
+ * This will ensure you don't leave the terminal in a broken state, even if
+ * the current task fails.
+ */
pub fn preserve<T> (body: &fn () -> T) -> T {
let orig = unsafe { c::get() };
do guard(|| { unsafe { c::set(orig) } }) {