mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 23:17:46 +00:00
Make the 'cat' utility build on Redox
This commit is contained in:
parent
07de3eda6e
commit
eedf7cb28a
2 changed files with 23 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue