1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-05 07:27:46 +00:00

Make the 'cat' utility build on Redox

This commit is contained in:
Ian Douglas Scott 2018-03-14 10:21:12 -07:00 committed by Roy Ivy III
parent 07de3eda6e
commit eedf7cb28a
2 changed files with 23 additions and 1 deletions

View file

@ -9,6 +9,9 @@ time = { version = "0.1.38", optional = true }
data-encoding = { version = "^1.1", optional = true } data-encoding = { version = "^1.1", optional = true }
libc = { version = "0.2.34", optional = true } libc = { version = "0.2.34", optional = true }
[target.'cfg(target_os = "redox")'.dependencies]
termion = "1.5"
[features] [features]
fs = ["libc"] fs = ["libc"]
utf8 = [] utf8 = []

View file

@ -5,12 +5,16 @@
// //
// For the full copyright and license information, please view the LICENSE // For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code. // file that was distributed with this source code.
//
#[cfg(target_os = "redox")]
extern crate termion;
#[cfg(unix)] #[cfg(unix)]
use super::libc; use super::libc;
use std::env; use std::env;
use std::fs; use std::fs;
#[cfg(target_os = "redox")]
use std::io;
use std::io::{Error, ErrorKind}; use std::io::{Error, ErrorKind};
use std::io::Result as IOResult; use std::io::Result as IOResult;
use std::path::{Component, Path, PathBuf}; use std::path::{Component, Path, PathBuf};
@ -157,6 +161,11 @@ pub fn is_stdin_interactive() -> bool {
false false
} }
#[cfg(target_os = "redox")]
pub fn is_stdin_interactive() -> bool {
termion::is_tty(&io::stdin())
}
#[cfg(unix)] #[cfg(unix)]
pub fn is_stdout_interactive() -> bool { pub fn is_stdout_interactive() -> bool {
unsafe { libc::isatty(libc::STDOUT_FILENO) == 1 } unsafe { libc::isatty(libc::STDOUT_FILENO) == 1 }
@ -167,6 +176,11 @@ pub fn is_stdout_interactive() -> bool {
false false
} }
#[cfg(target_os = "redox")]
pub fn is_stdout_interactive() -> bool {
termion::is_tty(&io::stdout())
}
#[cfg(unix)] #[cfg(unix)]
pub fn is_stderr_interactive() -> bool { pub fn is_stderr_interactive() -> bool {
unsafe { libc::isatty(libc::STDERR_FILENO) == 1 } unsafe { libc::isatty(libc::STDERR_FILENO) == 1 }
@ -176,3 +190,8 @@ pub fn is_stderr_interactive() -> bool {
pub fn is_stderr_interactive() -> bool { pub fn is_stderr_interactive() -> bool {
false false
} }
#[cfg(target_os = "redox")]
pub fn is_stderr_interactive() -> bool {
termion::is_tty(&io::stderr())
}