mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 14:52:41 +00:00
Make the 'cat' utility build on Redox
This commit is contained in:
parent
fa0b7ed41b
commit
1471e95b22
4 changed files with 25 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -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)",
|
||||
]
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ fuchsia = [
|
|||
]
|
||||
generic = [
|
||||
"arch",
|
||||
"cat",
|
||||
"hashsum",
|
||||
"hostname",
|
||||
"join",
|
||||
|
@ -96,6 +95,7 @@ redox_generic = [
|
|||
"base32",
|
||||
"base64",
|
||||
"basename",
|
||||
"cat",
|
||||
"cksum",
|
||||
"comm",
|
||||
"cp",
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue