Commit c5d9f763 authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub

Merge pull request #63 from ids1024/istty

Implement istty() using termios
parents 5804510c d72cfeb4
......@@ -177,3 +177,12 @@ libc_fn!(unsafe futimens(fd: c_int, times: *const [TimeSpec; 2]) -> Result<c_int
libc_fn!(_fcntl(file: c_int, cmd: c_int, arg: c_int) -> Result<c_int> {
Ok(syscall::fcntl(file as usize, cmd as usize, arg as usize)? as c_int)
});
libc_fn!(_isatty(file: c_int) -> c_int {
if let Ok(fd) = syscall::dup(file as usize, b"termios") {
let _ = syscall::close(fd);
1
} else {
0
}
});
......@@ -58,10 +58,6 @@ libc_fn!(unsafe vfork() -> c_int {
::process::_fork()
});
libc_fn!(_isatty(file: c_int) -> c_int {
(file == 0 || file == 1 || file == 2) as c_int
});
libc_fn!(ttyname(fd: c_int) -> Result<*const c_char> {
UNIMPL!(ttyname, EINVAL)
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment