mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #1010 from antiagainst/fuchsia
Enable compilation of more and ls on Fuchisa.
This commit is contained in:
Generated
+75
-82
File diff suppressed because it is too large
Load Diff
+5
-63
@@ -39,10 +39,10 @@ unix = [
|
||||
# Feature "fuchsia" contains the exclusive list of utilities
|
||||
# that can be compiled and run on Fuchsia. Should be built
|
||||
# with --no-default-features when selecting this feature.
|
||||
# TODO: merge with "generic"/"unix" to avoid duplication
|
||||
# once we support all utilities in that feature.
|
||||
# TODO: merge with "unix" to avoid duplication once we support
|
||||
# all utilities in that feature.
|
||||
fuchsia = [
|
||||
# From unix
|
||||
# unix utilities
|
||||
"arch",
|
||||
"chgrp",
|
||||
"chmod",
|
||||
@@ -62,66 +62,8 @@ fuchsia = [
|
||||
"uname",
|
||||
"unlink",
|
||||
|
||||
# From generic
|
||||
"base32",
|
||||
"base64",
|
||||
"basename",
|
||||
"cat",
|
||||
"cksum",
|
||||
"comm",
|
||||
"cp",
|
||||
"cut",
|
||||
"dircolors",
|
||||
"dirname",
|
||||
"echo",
|
||||
"env",
|
||||
"expand",
|
||||
"expr",
|
||||
"factor",
|
||||
"false",
|
||||
"fmt",
|
||||
"fold",
|
||||
"hashsum",
|
||||
"head",
|
||||
"link",
|
||||
"ln",
|
||||
"mkdir",
|
||||
"mktemp",
|
||||
"mv",
|
||||
"nl",
|
||||
"nproc",
|
||||
"od",
|
||||
"paste",
|
||||
"printenv",
|
||||
"printf",
|
||||
"ptx",
|
||||
"pwd",
|
||||
"readlink",
|
||||
"realpath",
|
||||
"relpath",
|
||||
"rm",
|
||||
"rmdir",
|
||||
"seq",
|
||||
"shred",
|
||||
"shuf",
|
||||
"sleep",
|
||||
"sort",
|
||||
"split",
|
||||
"sum",
|
||||
"sync",
|
||||
"tac",
|
||||
"tail",
|
||||
"tee",
|
||||
"test",
|
||||
"tr",
|
||||
"true",
|
||||
"truncate",
|
||||
"tsort",
|
||||
"unexpand",
|
||||
"uniq",
|
||||
"wc",
|
||||
"whoami",
|
||||
"yes",
|
||||
# All generic utilities
|
||||
"generic"
|
||||
]
|
||||
generic = [
|
||||
"base32",
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ path = "ls.rs"
|
||||
|
||||
[dependencies]
|
||||
getopts = "*"
|
||||
pretty-bytes = "0.1.0"
|
||||
pretty-bytes = "*"
|
||||
term_grid = "*"
|
||||
termsize = "*"
|
||||
time = "*"
|
||||
|
||||
+1
-2
@@ -9,10 +9,9 @@ path = "more.rs"
|
||||
|
||||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[target."cfg(unix)".dependencies]
|
||||
[target.'cfg(all(unix, not(target_os = "fuchsia")))'.dependencies]
|
||||
nix = "*"
|
||||
|
||||
[[bin]]
|
||||
|
||||
+10
-8
@@ -18,9 +18,9 @@ use getopts::Options;
|
||||
use std::io::{stdout, Write, Read};
|
||||
use std::fs::File;
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(all(unix, not(target_os = "fuchsia")))]
|
||||
extern crate nix;
|
||||
#[cfg(unix)]
|
||||
#[cfg(all(unix, not(target_os = "fuchsia")))]
|
||||
use nix::sys::termios;
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
@@ -76,7 +76,7 @@ fn help(usage: &str) {
|
||||
println!("{}", msg);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(all(unix, not(target_os = "fuchsia")))]
|
||||
fn setup_term() -> termios::Termios {
|
||||
let mut term = termios::tcgetattr(0).unwrap();
|
||||
// Unset canonical mode, so we get characters immediately
|
||||
@@ -87,19 +87,21 @@ fn setup_term() -> termios::Termios {
|
||||
term
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(any(windows, target_os = "fuchsia"))]
|
||||
#[inline(always)]
|
||||
fn setup_term() -> usize {
|
||||
0
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(all(unix, not(target_os = "fuchsia")))]
|
||||
fn reset_term(term: &mut termios::Termios) {
|
||||
term.c_lflag.insert(termios::ICANON);
|
||||
term.c_lflag.insert(termios::ECHO);
|
||||
termios::tcsetattr(0, termios::TCSADRAIN, &term).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(any(windows, target_os = "fuchsia"))]
|
||||
#[inline(always)]
|
||||
fn reset_term(_: &mut usize) {
|
||||
}
|
||||
|
||||
@@ -112,7 +114,7 @@ fn more(matches: getopts::Matches) {
|
||||
|
||||
let mut end = false;
|
||||
while let Ok(sz) = f.read(&mut buffer) {
|
||||
if sz == 0 { break; }
|
||||
if sz == 0 { break }
|
||||
stdout().write(&buffer[0..sz]).unwrap();
|
||||
for byte in std::io::stdin().bytes() {
|
||||
match byte.unwrap() {
|
||||
@@ -125,7 +127,7 @@ fn more(matches: getopts::Matches) {
|
||||
}
|
||||
}
|
||||
|
||||
if end { break;}
|
||||
if end { break }
|
||||
}
|
||||
|
||||
reset_term(&mut term);
|
||||
|
||||
Reference in New Issue
Block a user