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,21 +4,39 @@ version = "0.0.1"
authors = [] authors = []
build = "build.rs" build = "build.rs"
[features] [features]
default = ["all"] unix = [
all = [ "chroot",
"du",
"groups",
"hostid",
"hostname",
"id",
"kill",
"logname",
"mkfifo",
"mv",
"nice",
"nohup",
"stdbuf",
"timeout",
"touch",
"tty",
"uname",
"unlink",
"uptime",
"users",
]
generic = [
"base64", "base64",
"basename", "basename",
"cat", "cat",
"chmod", "chmod",
"chroot",
"cksum", "cksum",
"comm", "comm",
"cp", "cp",
"cut", "cut",
"dirname", "dirname",
"du",
"echo", "echo",
"env", "env",
"expand", "expand",
@ -27,22 +45,12 @@ all = [
"false", "false",
"fmt", "fmt",
"fold", "fold",
"groups",
"hashsum", "hashsum",
"head", "head",
"hostid",
"hostname",
"id",
"kill",
"link", "link",
"ln", "ln",
"logname",
"mkdir", "mkdir",
"mkfifo",
"mv",
"nice",
"nl", "nl",
"nohup",
"nproc", "nproc",
"od", "od",
"paste", "paste",
@ -59,30 +67,23 @@ all = [
"sleep", "sleep",
"sort", "sort",
"split", "split",
"stdbuf",
"sum", "sum",
"sync", "sync",
"tac", "tac",
"tail", "tail",
"tee", "tee",
"test", "test",
"timeout",
"touch",
"tr", "tr",
"true", "true",
"truncate", "truncate",
"tsort", "tsort",
"tty",
"uname",
"unexpand", "unexpand",
"uniq", "uniq",
"unlink",
"uptime",
"users",
"wc", "wc",
"whoami", "whoami",
"yes", "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;