aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-04-08 21:51:14 -0500
committerJesse Luehrs <doy@tozt.net>2013-04-08 21:51:14 -0500
commit50fe57cbcba4a35665e0c622852bfa33b024aea8 (patch)
tree499a896b1e1f1e31bdc50e0630c69289d598970b
parentfe6d6863b20495995924e6dd328746df617571d5 (diff)
downloadrust-term-50fe57cbcba4a35665e0c622852bfa33b024aea8.tar.gz
rust-term-50fe57cbcba4a35665e0c622852bfa33b024aea8.zip
isatty is already exposed, no need to do it again
-rw-r--r--src/term.rs2
-rw-r--r--src/util.rs9
-rw-r--r--test/termios3.rs14
3 files changed, 9 insertions, 16 deletions
diff --git a/src/term.rs b/src/term.rs
index e876dfa..dfe6dce 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -5,7 +5,7 @@
#[crate_type = "lib"];
-pub use util::{isatty,size};
+pub use util::size;
pub mod hexes;
pub mod info;
diff --git a/src/util.rs b/src/util.rs
index 2b3580e..09d8c11 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -37,12 +37,3 @@ pub fn size() -> (uint, uint) {
extern mod termios_wrapper {
fn size(cols: *c_uint, rows: *c_uint);
}
-
-pub fn isatty() -> bool {
- unsafe { c_isatty(0) as bool }
-}
-
-extern {
- #[link_name = "isatty"]
- fn c_isatty(fd: c_int) -> c_int;
-}
diff --git a/test/termios3.rs b/test/termios3.rs
index 9e24979..c387260 100644
--- a/test/termios3.rs
+++ b/test/termios3.rs
@@ -1,11 +1,13 @@
extern mod term;
fn main () {
- if term::isatty() {
- let (cols, rows) = term::size();
- println(fmt!("tty: %d %d", cols as int, rows as int));
- }
- else {
- println("not tty");
+ match io::stdout().get_type() {
+ io::Screen => {
+ let (cols, rows) = term::size();
+ println(fmt!("tty: %d %d", cols as int, rows as int));
+ }
+ io::File => {
+ println("not tty");
+ }
}
}