1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #735 from jbcrail/update-windows

Update Windows support.
This commit is contained in:
Heather 2015-11-30 08:38:32 +04:00
commit b18c558d6c
6 changed files with 89 additions and 87 deletions

View file

@ -4,85 +4,86 @@ version = "0.0.1"
authors = [] authors = []
build = "build.rs" build = "build.rs"
[features] [features]
default = ["all"] unix = [
all = [ "chroot",
"base64", "du",
"basename", "groups",
"cat", "hostid",
"chmod", "hostname",
"chroot", "id",
"cksum", "kill",
"comm", "logname",
"cp", "mkfifo",
"cut", "mv",
"dirname", "nice",
"du", "nohup",
"echo", "stdbuf",
"env", "timeout",
"expand", "touch",
"expr", "tty",
"factor", "uname",
"false", "unlink",
"fmt", "uptime",
"fold", "users",
"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",
] ]
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] [dependencies]
uucore = { path="src/uucore" } uucore = { path="src/uucore" }
@ -178,4 +179,3 @@ tempdir="*"
[[bin]] [[bin]]
name="uutils" name="uutils"
path="src/uutils/uutils.rs" path="src/uutils/uutils.rs"

View file

@ -12,8 +12,7 @@ pub fn main() {
if val == "1" && key.starts_with(feature_prefix) { if val == "1" && key.starts_with(feature_prefix) {
let krate = key[feature_prefix.len()..].to_lowercase(); let krate = key[feature_prefix.len()..].to_lowercase();
match krate.as_ref() { match krate.as_ref() {
"default" => continue, "default" | "unix" | "generic" => continue,
"all" => continue,
_ => {}, _ => {},
} }
crates.push(krate.to_string()); crates.push(krate.to_string());

View file

@ -15,9 +15,8 @@ extern crate libc;
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use std::ffi::CString;
use std::fs; use std::fs;
use std::io::{Error, Write}; use std::io::Write;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use uucore::fs::UUPathExt; use uucore::fs::UUPathExt;
@ -137,6 +136,9 @@ fn mkdir(path: &Path, mode: u16, verbose: bool) -> i32 {
#[cfg(unix)] #[cfg(unix)]
fn chmod(path: &Path, mode: u16) -> i32 { 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 directory = CString::new(path.as_os_str().to_str().unwrap()).unwrap_or_else(|e| crash!(1, "{}", e));
let mode = mode as libc::mode_t; let mode = mode as libc::mode_t;

View file

@ -12,7 +12,7 @@
extern crate libc; extern crate libc;
use std::collections::HashMap; use std::collections::HashMap;
use std::ffi::{CString, OsString}; use std::ffi::OsString;
use std::env::{args_os}; use std::env::{args_os};
use std::str::{from_utf8}; use std::str::{from_utf8};
@ -328,6 +328,8 @@ enum PathCondition {
fn path(path: &[u8], cond: PathCondition) -> bool { 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::{stat, lstat, S_IFMT, S_IFLNK, S_IFBLK, S_IFCHR, S_IFDIR, S_IFREG};
use libc::{S_IFIFO, mode_t}; use libc::{S_IFIFO, mode_t};
use std::ffi::CString;
static S_ISUID: mode_t = 0o4000; static S_ISUID: mode_t = 0o4000;
static S_ISGID: mode_t = 0o2000; static S_ISGID: mode_t = 0o2000;
static S_IFSOCK: mode_t = 0o140000; static S_IFSOCK: mode_t = 0o140000;

View file

@ -4,10 +4,11 @@ extern crate time;
#[macro_use] #[macro_use]
mod macros; mod macros;
pub mod c_types;
pub mod fs; pub mod fs;
pub mod parse_time; 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 signals;
#[cfg(unix)] pub mod utmpx; #[cfg(unix)] pub mod utmpx;

View file

@ -9,8 +9,6 @@
extern crate winapi; extern crate winapi;
extern crate advapi32; extern crate advapi32;
#[macro_use]
extern crate uucore; extern crate uucore;
use std::ffi::OsString; use std::ffi::OsString;