diff --git a/Cargo.lock b/Cargo.lock index f7fb30ba2..a3e5affa7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1714,6 +1714,7 @@ dependencies = [ "data-encoding 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index 02bb94d33..ef5358f25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,7 +65,6 @@ fuchsia = [ ] generic = [ "arch", - "cat", "hashsum", "hostname", "join", @@ -96,6 +95,7 @@ redox_generic = [ "base32", "base64", "basename", + "cat", "cksum", "comm", "cp", diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index d18f834b3..37f16289c 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -9,6 +9,9 @@ time = { version = "0.1.38", optional = true } data-encoding = { version = "^1.1", optional = true } libc = { version = "0.2.34", optional = true } +[target.'cfg(target_os = "redox")'.dependencies] +termion = "1.5" + [features] fs = ["libc"] utf8 = [] diff --git a/src/uucore/fs.rs b/src/uucore/fs.rs index 1fbf46de0..cecaf529f 100644 --- a/src/uucore/fs.rs +++ b/src/uucore/fs.rs @@ -5,12 +5,16 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// + +#[cfg(target_os = "redox")] +extern crate termion; #[cfg(unix)] use super::libc; use std::env; use std::fs; +#[cfg(target_os = "redox")] +use std::io; use std::io::{Error, ErrorKind}; use std::io::Result as IOResult; use std::path::{Component, Path, PathBuf}; @@ -157,6 +161,11 @@ pub fn is_stdin_interactive() -> bool { false } +#[cfg(target_os = "redox")] +pub fn is_stdin_interactive() -> bool { + termion::is_tty(&io::stdin()) +} + #[cfg(unix)] pub fn is_stdout_interactive() -> bool { unsafe { libc::isatty(libc::STDOUT_FILENO) == 1 } @@ -167,6 +176,11 @@ pub fn is_stdout_interactive() -> bool { false } +#[cfg(target_os = "redox")] +pub fn is_stdout_interactive() -> bool { + termion::is_tty(&io::stdout()) +} + #[cfg(unix)] pub fn is_stderr_interactive() -> bool { unsafe { libc::isatty(libc::STDERR_FILENO) == 1 } @@ -176,3 +190,8 @@ pub fn is_stderr_interactive() -> bool { pub fn is_stderr_interactive() -> bool { false } + +#[cfg(target_os = "redox")] +pub fn is_stderr_interactive() -> bool { + termion::is_tty(&io::stderr()) +}