aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs
index c9f85e5..43a1a69 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -39,3 +39,12 @@ pub fn timed_read (timeout: int) -> Option<char> {
extern mod io_helper {
fn timed_read (timeout: c_int) -> c_int;
}
+
+pub fn isatty() -> bool {
+ unsafe { c_isatty(0) as bool }
+}
+
+extern {
+ #[link_name = "isatty"]
+ fn c_isatty(fd: c_int) -> c_int;
+}