1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 use sys::fs::FileDesc;
14 use libc::{self, c_int};
15 use io::{self, IoResult, IoError};
23 pub fn new(fd: c_int) -> IoResult<TTY> {
24 if unsafe { libc::isatty(fd) } != 0 {
25 Ok(TTY { fd: FileDesc::new(fd, true) })
28 kind: io::MismatchedFileTypeForOperation,
29 desc: "file descriptor is not a TTY",
35 pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
38 pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
41 pub fn set_raw(&mut self, _raw: bool) -> IoResult<()> {
42 Err(sys_common::unimpl())
44 pub fn get_winsize(&mut self) -> IoResult<(int, int)> {
45 Err(sys_common::unimpl())
47 pub fn isatty(&self) -> bool { false }