mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #735 from jbcrail/update-windows
Update Windows support.
This commit is contained in:
commit
b18c558d6c
6 changed files with 89 additions and 87 deletions
156
Cargo.toml
156
Cargo.toml
|
@ -4,85 +4,86 @@ version = "0.0.1"
|
|||
authors = []
|
||||
build = "build.rs"
|
||||
|
||||
|
||||
[features]
|
||||
default = ["all"]
|
||||
all = [
|
||||
"base64",
|
||||
"basename",
|
||||
"cat",
|
||||
"chmod",
|
||||
"chroot",
|
||||
"cksum",
|
||||
"comm",
|
||||
"cp",
|
||||
"cut",
|
||||
"dirname",
|
||||
"du",
|
||||
"echo",
|
||||
"env",
|
||||
"expand",
|
||||
"expr",
|
||||
"factor",
|
||||
"false",
|
||||
"fmt",
|
||||
"fold",
|
||||
"groups",
|
||||
"hashsum",
|
||||
"head",
|
||||
"hostid",
|
||||
"hostname",
|
||||
"id",
|
||||
"kill",
|
||||
"link",
|
||||
"ln",
|
||||
"logname",
|
||||
"mkdir",
|
||||
"mkfifo",
|
||||
"mv",
|
||||
"nice",
|
||||
"nl",
|
||||
"nohup",
|
||||
"nproc",
|
||||
"od",
|
||||
"paste",
|
||||
"printenv",
|
||||
"ptx",
|
||||
"pwd",
|
||||
"readlink",
|
||||
"realpath",
|
||||
"relpath",
|
||||
"rm",
|
||||
"rmdir",
|
||||
"seq",
|
||||
"shuf",
|
||||
"sleep",
|
||||
"sort",
|
||||
"split",
|
||||
"stdbuf",
|
||||
"sum",
|
||||
"sync",
|
||||
"tac",
|
||||
"tail",
|
||||
"tee",
|
||||
"test",
|
||||
"timeout",
|
||||
"touch",
|
||||
"tr",
|
||||
"true",
|
||||
"truncate",
|
||||
"tsort",
|
||||
"tty",
|
||||
"uname",
|
||||
"unexpand",
|
||||
"uniq",
|
||||
"unlink",
|
||||
"uptime",
|
||||
"users",
|
||||
"wc",
|
||||
"whoami",
|
||||
"yes",
|
||||
unix = [
|
||||
"chroot",
|
||||
"du",
|
||||
"groups",
|
||||
"hostid",
|
||||
"hostname",
|
||||
"id",
|
||||
"kill",
|
||||
"logname",
|
||||
"mkfifo",
|
||||
"mv",
|
||||
"nice",
|
||||
"nohup",
|
||||
"stdbuf",
|
||||
"timeout",
|
||||
"touch",
|
||||
"tty",
|
||||
"uname",
|
||||
"unlink",
|
||||
"uptime",
|
||||
"users",
|
||||
]
|
||||
generic = [
|
||||
"base64",
|
||||
"basename",
|
||||
"cat",
|
||||
"chmod",
|
||||
"cksum",
|
||||
"comm",
|
||||
"cp",
|
||||
"cut",
|
||||
"dirname",
|
||||
"echo",
|
||||
"env",
|
||||
"expand",
|
||||
"expr",
|
||||
"factor",
|
||||
"false",
|
||||
"fmt",
|
||||
"fold",
|
||||
"hashsum",
|
||||
"head",
|
||||
"link",
|
||||
"ln",
|
||||
"mkdir",
|
||||
"nl",
|
||||
"nproc",
|
||||
"od",
|
||||
"paste",
|
||||
"printenv",
|
||||
"ptx",
|
||||
"pwd",
|
||||
"readlink",
|
||||
"realpath",
|
||||
"relpath",
|
||||
"rm",
|
||||
"rmdir",
|
||||
"seq",
|
||||
"shuf",
|
||||
"sleep",
|
||||
"sort",
|
||||
"split",
|
||||
"sum",
|
||||
"sync",
|
||||
"tac",
|
||||
"tail",
|
||||
"tee",
|
||||
"test",
|
||||
"tr",
|
||||
"true",
|
||||
"truncate",
|
||||
"tsort",
|
||||
"unexpand",
|
||||
"uniq",
|
||||
"wc",
|
||||
"whoami",
|
||||
"yes",
|
||||
]
|
||||
default = ["generic", "unix"]
|
||||
|
||||
[dependencies]
|
||||
uucore = { path="src/uucore" }
|
||||
|
@ -178,4 +179,3 @@ tempdir="*"
|
|||
[[bin]]
|
||||
name="uutils"
|
||||
path="src/uutils/uutils.rs"
|
||||
|
||||
|
|
3
build.rs
3
build.rs
|
@ -12,8 +12,7 @@ pub fn main() {
|
|||
if val == "1" && key.starts_with(feature_prefix) {
|
||||
let krate = key[feature_prefix.len()..].to_lowercase();
|
||||
match krate.as_ref() {
|
||||
"default" => continue,
|
||||
"all" => continue,
|
||||
"default" | "unix" | "generic" => continue,
|
||||
_ => {},
|
||||
}
|
||||
crates.push(krate.to_string());
|
||||
|
|
|
@ -15,9 +15,8 @@ extern crate libc;
|
|||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::fs;
|
||||
use std::io::{Error, Write};
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use uucore::fs::UUPathExt;
|
||||
|
||||
|
@ -137,6 +136,9 @@ fn mkdir(path: &Path, mode: u16, verbose: bool) -> i32 {
|
|||
|
||||
#[cfg(unix)]
|
||||
fn chmod(path: &Path, mode: u16) -> i32 {
|
||||
use std::ffi::CString;
|
||||
use std::io::Error;
|
||||
|
||||
let directory = CString::new(path.as_os_str().to_str().unwrap()).unwrap_or_else(|e| crash!(1, "{}", e));
|
||||
let mode = mode as libc::mode_t;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
extern crate libc;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::{CString, OsString};
|
||||
use std::ffi::OsString;
|
||||
use std::env::{args_os};
|
||||
use std::str::{from_utf8};
|
||||
|
||||
|
@ -328,6 +328,8 @@ enum PathCondition {
|
|||
fn path(path: &[u8], cond: PathCondition) -> bool {
|
||||
use libc::{stat, lstat, S_IFMT, S_IFLNK, S_IFBLK, S_IFCHR, S_IFDIR, S_IFREG};
|
||||
use libc::{S_IFIFO, mode_t};
|
||||
use std::ffi::CString;
|
||||
|
||||
static S_ISUID: mode_t = 0o4000;
|
||||
static S_ISGID: mode_t = 0o2000;
|
||||
static S_IFSOCK: mode_t = 0o140000;
|
||||
|
|
|
@ -4,10 +4,11 @@ extern crate time;
|
|||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
pub mod c_types;
|
||||
pub mod fs;
|
||||
pub mod parse_time;
|
||||
pub mod process;
|
||||
|
||||
#[cfg(unix)] pub mod c_types;
|
||||
#[cfg(unix)] pub mod process;
|
||||
#[cfg(unix)] pub mod signals;
|
||||
#[cfg(unix)] pub mod utmpx;
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
extern crate winapi;
|
||||
extern crate advapi32;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::ffi::OsString;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue