aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-03-21 01:16:29 -0500
committerJesse Luehrs <doy@tozt.net>2013-03-21 01:16:29 -0500
commit3c8d221d7fa7f5e71abbaa753044d5015948f0ea (patch)
treee0f6c507c4d1b76fda737c1d67500dcd327fe25e /src/term.rs
parent50db2cec5f96d2f26ab5363a1beb870ed6482abc (diff)
downloadrust-term-3c8d221d7fa7f5e71abbaa753044d5015948f0ea.tar.gz
rust-term-3c8d221d7fa7f5e71abbaa753044d5015948f0ea.zip
isatty doesn't really belong with termios
Diffstat (limited to 'src/term.rs')
-rw-r--r--src/term.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/term.rs b/src/term.rs
index faceb12..6a4d3b5 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -2,7 +2,9 @@
#[crate_type = "lib"];
-pub use ios::{cooked,cbreak,raw,echo,size,isatty};
+use core::libc::c_int;
+
+pub use ios::{cooked,cbreak,raw,echo,size};
use info::{init,escape,escape2};
struct Writer {
@@ -62,6 +64,15 @@ impl Drop for Writer {
}
}
+pub fn isatty() -> bool {
+ unsafe { c_isatty(0) as bool }
+}
+
pub mod ios;
pub mod info;
mod util;
+
+extern {
+ #[link_name = "isatty"]
+ fn c_isatty(fd: c_int) -> c_int;
+}