mirror of
https://github.com/uutils/coreutils
synced 2024-07-21 09:54:42 +00:00
Split utility files into separate library.
Everything in src/common has been moved to src/uucore. This is defined as a Cargo library, instead of directly included. This gives us flexibility to make the library an external crate in the future. Fixes #717.
This commit is contained in:
parent
072f48f039
commit
ca1074201f
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
|||
target/
|
||||
/src/*/gen_table
|
||||
/target/
|
||||
/build/
|
||||
/tmp/
|
||||
/busybox/
|
||||
*~
|
||||
|
|
|
@ -85,6 +85,7 @@ all = [
|
|||
]
|
||||
|
||||
[dependencies]
|
||||
uucore = { path="src/uucore" }
|
||||
base64 = { optional=true, path="src/base64" }
|
||||
basename = { optional=true, path="src/basename" }
|
||||
cat = { optional=true, path="src/cat" }
|
||||
|
|
|
@ -11,6 +11,7 @@ path = "base64.rs"
|
|||
getopts = "*"
|
||||
libc = "*"
|
||||
rustc-serialize = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="base64"
|
||||
|
|
|
@ -13,6 +13,9 @@ extern crate rustc_serialize as serialize;
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use getopts::Options;
|
||||
use serialize::base64::{self, FromBase64, ToBase64};
|
||||
use std::ascii::AsciiExt;
|
||||
|
@ -21,10 +24,6 @@ use std::fs::File;
|
|||
use std::io::{BufReader, Read, stdin, stdout, Write};
|
||||
use std::path::Path;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
enum Mode {
|
||||
Decode,
|
||||
Encode,
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "basename.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="basename"
|
||||
|
|
|
@ -12,14 +12,13 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use getopts::Options;
|
||||
use std::io::Write;
|
||||
use std::path::{is_separator, PathBuf};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "basename";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "cat.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="cat"
|
||||
|
|
|
@ -14,16 +14,15 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use libc::STDIN_FILENO;
|
||||
use libc::{c_int, isatty};
|
||||
use getopts::Options;
|
||||
use std::fs::File;
|
||||
use std::intrinsics::{copy_nonoverlapping};
|
||||
use std::io::{stdout, stdin, stderr, Write, Read, Result};
|
||||
use libc::STDIN_FILENO;
|
||||
use libc::{c_int, isatty};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "cat";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
|
|
@ -14,6 +14,7 @@ aho-corasick = "*"
|
|||
memchr = "*"
|
||||
regex = "*"
|
||||
regex-syntax = "*"
|
||||
uucore = { path="../uucore" }
|
||||
walker = "*"
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -19,23 +19,18 @@ extern crate regex;
|
|||
extern crate regex_syntax;
|
||||
extern crate walker;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use getopts::Options;
|
||||
use regex::Regex;
|
||||
use std::ffi::CString;
|
||||
use std::io::{Error, Write};
|
||||
use std::mem;
|
||||
use std::path::Path;
|
||||
use uucore::fs::UUPathExt;
|
||||
use walker::Walker;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::UUPathExt;
|
||||
|
||||
const NAME: &'static str = "chmod";
|
||||
const VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "chroot.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="chroot"
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use c_types::{get_pw_from_args, get_group};
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use getopts::Options;
|
||||
use libc::{setgid, setuid};
|
||||
use std::ffi::CString;
|
||||
|
@ -20,12 +22,8 @@ use std::io::{Error, Write};
|
|||
use std::iter::FromIterator;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
#[path = "../common/util.rs"] #[macro_use] mod util;
|
||||
#[path = "../common/c_types.rs"] mod c_types;
|
||||
#[path = "../common/filesystem.rs"] mod filesystem;
|
||||
|
||||
use filesystem::UUPathExt;
|
||||
use uucore::c_types::{get_pw_from_args, get_group};
|
||||
use uucore::fs::UUPathExt;
|
||||
|
||||
extern {
|
||||
fn chroot(path: *const libc::c_char) -> libc::c_int;
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "cksum.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="cksum"
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use getopts::Options;
|
||||
use std::fs::File;
|
||||
use std::io::{self, stdin, Read, Write, BufReader};
|
||||
|
@ -19,10 +22,6 @@ use std::path::Path;
|
|||
|
||||
use crc_table::CRC_TABLE;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
mod crc_table;
|
||||
|
||||
static NAME: &'static str = "cksum";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "cp.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="cp"
|
||||
|
|
13
src/cp/cp.rs
13
src/cp/cp.rs
|
@ -11,19 +11,14 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use getopts::Options;
|
||||
use std::fs;
|
||||
use std::io::{ErrorKind, Result, Write};
|
||||
use std::path::Path;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::{canonicalize, CanonicalizeMode, UUPathExt};
|
||||
use uucore::fs::{canonicalize, CanonicalizeMode, UUPathExt};
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub enum Mode {
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "cut.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="cut"
|
||||
|
|
|
@ -12,22 +12,17 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::{stdout, stdin, BufRead, BufReader, Read, Stdout, Write};
|
||||
use std::path::Path;
|
||||
use uucore::fs::UUPathExt;
|
||||
|
||||
use ranges::Range;
|
||||
use searcher::Searcher;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::UUPathExt;
|
||||
|
||||
mod buffer;
|
||||
mod ranges;
|
||||
mod searcher;
|
||||
|
|
|
@ -11,6 +11,7 @@ path = "du.rs"
|
|||
getopts = "*"
|
||||
libc = "*"
|
||||
time = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="du"
|
||||
|
|
|
@ -15,6 +15,9 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
extern crate time;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs;
|
||||
use std::io::{stderr, Write};
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
@ -24,10 +27,6 @@ use time::Timespec;
|
|||
use std::sync::mpsc::channel;
|
||||
use std::thread;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "du";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "echo.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="echo"
|
||||
|
|
|
@ -12,13 +12,12 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::io::Write;
|
||||
use std::str::from_utf8;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[allow(dead_code)]
|
||||
static NAME: &'static str = "echo";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
|
1
src/env/Cargo.toml
vendored
1
src/env/Cargo.toml
vendored
|
@ -10,6 +10,7 @@ path = "env.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="env"
|
||||
|
|
7
src/env/env.rs
vendored
7
src/env/env.rs
vendored
|
@ -13,14 +13,13 @@
|
|||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::env;
|
||||
use std::io::Write;
|
||||
use std::process::Command;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "env";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ path = "expand.rs"
|
|||
getopts = "*"
|
||||
libc = "*"
|
||||
unicode-width = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="expand"
|
||||
|
|
|
@ -17,6 +17,9 @@ extern crate libc;
|
|||
extern crate rustc_unicode;
|
||||
extern crate unicode_width;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
|
||||
use std::iter::repeat;
|
||||
|
@ -24,10 +27,6 @@ use std::str::from_utf8;
|
|||
use rustc_unicode::str::utf8_char_width;
|
||||
use unicode_width::UnicodeWidthChar;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "expand";
|
||||
static VERSION: &'static str = "0.0.1";
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ path = "expr.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="expr"
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
extern crate uucore;
|
||||
|
||||
mod tokens;
|
||||
mod syntax_tree;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ path = "factor.rs"
|
|||
getopts = "*"
|
||||
libc = "*"
|
||||
rand = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="factor"
|
||||
|
|
|
@ -17,6 +17,9 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
extern crate rand;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use numeric::*;
|
||||
use prime_table::P_INVS_U64;
|
||||
use rand::weak_rng;
|
||||
|
@ -26,9 +29,6 @@ use std::io::{stdin, BufRead, BufReader, Write};
|
|||
use std::num::Wrapping;
|
||||
use std::mem::swap;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
mod numeric;
|
||||
mod prime_table;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ path = "fmt.rs"
|
|||
getopts = "*"
|
||||
libc = "*"
|
||||
unicode-width = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="fmt"
|
||||
|
|
|
@ -14,6 +14,9 @@ extern crate getopts;
|
|||
extern crate rustc_unicode;
|
||||
extern crate unicode_width;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::cmp;
|
||||
use std::io::{Read, BufReader, BufWriter};
|
||||
use std::fs::File;
|
||||
|
@ -30,9 +33,6 @@ macro_rules! silent_unwrap(
|
|||
)
|
||||
);
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
mod linebreak;
|
||||
mod parasplit;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "fold.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="fold"
|
||||
|
|
|
@ -12,14 +12,13 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader, Read, stdin, Write};
|
||||
use std::path::Path;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "fold";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "groups.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="groups"
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
* file that was distributed with this source code.
|
||||
*
|
||||
*/
|
||||
|
||||
extern crate getopts;
|
||||
|
||||
use c_types::{get_pw_from_args, group};
|
||||
use std::io::Write;
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
#[path = "../common/util.rs"] #[macro_use] mod util;
|
||||
#[path = "../common/c_types.rs"] mod c_types;
|
||||
use std::io::Write;
|
||||
use uucore::c_types::{get_pw_from_args, group};
|
||||
|
||||
static NAME: &'static str = "groups";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
|
|
@ -13,6 +13,7 @@ libc = "*"
|
|||
regex = "*"
|
||||
regex-syntax = "*"
|
||||
rust-crypto = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="hashsum"
|
||||
|
|
|
@ -16,6 +16,9 @@ extern crate getopts;
|
|||
extern crate regex_syntax;
|
||||
extern crate regex;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use crypto::digest::Digest;
|
||||
use crypto::md5::Md5;
|
||||
use crypto::sha1::Sha1;
|
||||
|
@ -26,10 +29,6 @@ use std::fs::File;
|
|||
use std::io::{self, BufRead, BufReader, Read, stdin, Write};
|
||||
use std::path::Path;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "hashsum";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "head.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="head"
|
||||
|
|
|
@ -13,15 +13,14 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::io::{BufRead, BufReader, Read, stdin, Write};
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use std::str::from_utf8;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "head";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "hostid.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="hostid"
|
||||
|
|
|
@ -12,11 +12,10 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use libc::c_long;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
extern crate uucore;
|
||||
|
||||
use libc::c_long;
|
||||
|
||||
static NAME: &'static str = "hostid";
|
||||
static VERSION: &'static str = "0.0.1";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "hostname.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="hostname"
|
||||
|
|
|
@ -16,16 +16,15 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use getopts::Options;
|
||||
use std::collections::hash_set::HashSet;
|
||||
use std::iter::repeat;
|
||||
use std::str;
|
||||
use std::io::Write;
|
||||
use std::net::ToSocketAddrs;
|
||||
use getopts::Options;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "hostname";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "id.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="id"
|
||||
|
|
|
@ -17,11 +17,14 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use libc::{getgid, getuid, uid_t, getegid, geteuid, getlogin};
|
||||
use std::ffi::CStr;
|
||||
use std::io::Write;
|
||||
use std::ptr::read;
|
||||
use c_types::{
|
||||
use uucore::c_types::{
|
||||
c_passwd,
|
||||
c_group,
|
||||
get_groups,
|
||||
|
@ -31,9 +34,6 @@ use c_types::{
|
|||
group
|
||||
};
|
||||
|
||||
#[path = "../common/util.rs"] #[macro_use] mod util;
|
||||
#[path = "../common/c_types.rs"] mod c_types;
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
mod audit {
|
||||
pub use std::mem::uninitialized;
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "kill.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="kill"
|
||||
|
|
|
@ -12,19 +12,12 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use libc::{c_int, pid_t};
|
||||
use signals::ALL_SIGNALS;
|
||||
use std::io::{Error, Write};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
extern crate uucore;
|
||||
|
||||
#[path = "../common/c_types.rs"]
|
||||
mod c_types;
|
||||
|
||||
#[path = "../common/signals.rs"]
|
||||
mod signals;
|
||||
use libc::{c_int, pid_t};
|
||||
use std::io::{Error, Write};
|
||||
use uucore::signals::ALL_SIGNALS;
|
||||
|
||||
static NAME: &'static str = "kill";
|
||||
static VERSION: &'static str = "0.0.1";
|
||||
|
@ -96,7 +89,7 @@ fn handle_obsolete(mut args: Vec<String>) -> (Vec<String>, Option<String>) {
|
|||
let val = &slice[1..];
|
||||
match val.parse() {
|
||||
Ok(num) => {
|
||||
if signals::is_signal(num) {
|
||||
if uucore::signals::is_signal(num) {
|
||||
args.remove(i);
|
||||
return (args, Some(val.to_string()));
|
||||
}
|
||||
|
@ -174,7 +167,7 @@ Usage:
|
|||
|
||||
fn kill(signalname: &str, pids: std::vec::Vec<String>) -> i32 {
|
||||
let mut status = 0;
|
||||
let optional_signal_value = signals::signal_by_name_or_value(signalname);
|
||||
let optional_signal_value = uucore::signals::signal_by_name_or_value(signalname);
|
||||
let signal_value = match optional_signal_value {
|
||||
Some(x) => x,
|
||||
None => crash!(EXIT_ERR, "unknown signal name {}", signalname)
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "link.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="link"
|
||||
|
|
|
@ -11,14 +11,13 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs::hard_link;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "link";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "ln.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="ln"
|
||||
|
|
13
src/ln/ln.rs
13
src/ln/ln.rs
|
@ -11,20 +11,15 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs;
|
||||
use std::io::{BufRead, BufReader, Result, stdin, Write};
|
||||
#[cfg(unix)] use std::os::unix::fs::symlink as symlink_file;
|
||||
#[cfg(windows)] use std::os::windows::fs::symlink_file;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path="../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::UUPathExt;
|
||||
use uucore::fs::UUPathExt;
|
||||
|
||||
static NAME: &'static str = "ln";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "logname.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="logname"
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::ffi::CStr;
|
||||
use std::io::Write;
|
||||
|
||||
#[path = "../common/util.rs"] #[macro_use] mod util;
|
||||
|
||||
extern {
|
||||
// POSIX requires using getlogin (or equivalent code)
|
||||
pub fn getlogin() -> *const libc::c_char;
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "mkdir.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="mkdir"
|
||||
|
|
|
@ -12,19 +12,14 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::fs;
|
||||
use std::io::{Error, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::UUPathExt;
|
||||
use uucore::fs::UUPathExt;
|
||||
|
||||
static NAME: &'static str = "mkdir";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "mkfifo.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="mkfifo"
|
||||
|
|
|
@ -12,14 +12,13 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use libc::mkfifo;
|
||||
use std::ffi::CString;
|
||||
use std::io::{Error, Write};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "mkfifo";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "mv.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[dev-dependencies]
|
||||
time = "*"
|
||||
|
|
13
src/mv/mv.rs
13
src/mv/mv.rs
|
@ -13,19 +13,14 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs;
|
||||
use std::io::{BufRead, BufReader, Result, stdin, Write};
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::UUPathExt;
|
||||
use uucore::fs::UUPathExt;
|
||||
|
||||
static NAME: &'static str = "mv";
|
||||
static VERSION: &'static str = "0.0.1";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "nice.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="nice"
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use libc::{c_char, c_int, execvp};
|
||||
use std::ffi::CString;
|
||||
use std::io::{Error, Write};
|
||||
|
@ -22,10 +25,6 @@ const VERSION: &'static str = "1.0.0";
|
|||
// XXX: PRIO_PROCESS is 0 on at least FreeBSD and Linux. Don't know about Mac OS X.
|
||||
const PRIO_PROCESS: c_int = 0;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
extern {
|
||||
fn getpriority(which: c_int, who: c_int) -> c_int;
|
||||
fn setpriority(which: c_int, who: c_int, prio: c_int) -> c_int;
|
||||
|
|
|
@ -14,6 +14,7 @@ aho-corasick = "*"
|
|||
memchr = "*"
|
||||
regex = "*"
|
||||
regex-syntax = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="nl"
|
||||
|
|
|
@ -16,14 +16,14 @@ extern crate memchr;
|
|||
extern crate regex_syntax;
|
||||
extern crate regex;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader, Read, stdin, Write};
|
||||
use std::iter::repeat;
|
||||
use std::path::Path;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
mod helper;
|
||||
|
||||
static NAME: &'static str = "nl";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "nohup.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="nohup"
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use libc::{c_char, signal, dup2, execvp, isatty};
|
||||
use libc::{SIG_IGN, SIGHUP};
|
||||
use std::ffi::CString;
|
||||
|
@ -21,9 +24,6 @@ use std::os::unix::prelude::*;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::env;
|
||||
|
||||
#[path = "../common/util.rs"] #[macro_use] mod util;
|
||||
#[path = "../common/c_types.rs"] mod c_types;
|
||||
|
||||
static NAME: &'static str = "nohup";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ path = "nproc.rs"
|
|||
getopts = "*"
|
||||
libc = "*"
|
||||
num_cpus = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="nproc"
|
||||
|
|
|
@ -12,16 +12,15 @@
|
|||
extern crate getopts;
|
||||
extern crate num_cpus;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::io::Write;
|
||||
use std::env;
|
||||
|
||||
static NAME : &'static str = "nproc";
|
||||
static VERSION : &'static str = "0.0.0";
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let mut opts = getopts::Options::new();
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "paste.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="paste"
|
||||
|
|
|
@ -12,15 +12,14 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::io::{BufRead, BufReader, Read, stdin, Write};
|
||||
use std::iter::repeat;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "paste";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "printenv.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="printenv"
|
||||
|
|
|
@ -14,13 +14,12 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::io::Write;
|
||||
use std::env;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "printenv";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ aho-corasick = "*"
|
|||
memchr = "*"
|
||||
regex-syntax = "*"
|
||||
regex = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="ptx"
|
||||
|
|
|
@ -15,18 +15,16 @@ extern crate memchr;
|
|||
extern crate regex_syntax;
|
||||
extern crate regex;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use getopts::{Options, Matches};
|
||||
use regex::Regex;
|
||||
use std::cmp;
|
||||
use std::collections::{HashMap, HashSet, BTreeSet};
|
||||
use std::default::Default;
|
||||
use std::fs::File;
|
||||
use getopts::{Options, Matches};
|
||||
use std::io::{stdin, stdout, BufReader, BufWriter, BufRead, Read, Write};
|
||||
use regex::Regex;
|
||||
use std::cmp;
|
||||
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "ptx";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "pwd.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="pwd"
|
||||
|
|
|
@ -12,13 +12,12 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::io::Write;
|
||||
use std::env;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "pwd";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "readlink.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="readlink"
|
||||
|
|
|
@ -11,18 +11,13 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::{canonicalize, CanonicalizeMode};
|
||||
use uucore::fs::{canonicalize, CanonicalizeMode};
|
||||
|
||||
const NAME: &'static str = "readlink";
|
||||
const VERSION: &'static str = "0.0.1";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "realpath.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="realpath"
|
||||
|
|
|
@ -12,18 +12,13 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::{canonicalize, CanonicalizeMode};
|
||||
use uucore::fs::{canonicalize, CanonicalizeMode};
|
||||
|
||||
static NAME: &'static str = "realpath";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "relpath.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="relpath"
|
||||
|
|
|
@ -12,18 +12,13 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::env;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::{canonicalize, CanonicalizeMode};
|
||||
use uucore::fs::{canonicalize, CanonicalizeMode};
|
||||
|
||||
static NAME: &'static str = "relpath";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "rm.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="rm"
|
||||
|
|
13
src/rm/rm.rs
13
src/rm/rm.rs
|
@ -12,20 +12,15 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::collections::VecDeque;
|
||||
use std::fs;
|
||||
use std::io::{stdin, stderr, BufRead, Write};
|
||||
use std::ops::BitOr;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::UUPathExt;
|
||||
use uucore::fs::UUPathExt;
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Copy)]
|
||||
enum InteractiveMode {
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "rmdir.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="rmdir"
|
||||
|
|
|
@ -12,14 +12,13 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "rmdir";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "seq.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="seq"
|
||||
|
|
|
@ -6,13 +6,12 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::cmp;
|
||||
use std::io::Write;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "seq";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ path = "shuf.rs"
|
|||
getopts = "*"
|
||||
libc = "*"
|
||||
rand = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="shuf"
|
||||
|
|
|
@ -13,16 +13,15 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
extern crate rand;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use rand::{Rng, ThreadRng};
|
||||
use rand::read::ReadRng;
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
|
||||
use std::usize::MAX as MAX_USIZE;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
enum Mode {
|
||||
Default,
|
||||
Echo,
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "sleep.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="sleep"
|
||||
|
|
|
@ -12,18 +12,14 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::io::Write;
|
||||
use std::thread::{self};
|
||||
use std::time::Duration;
|
||||
use std::u32::MAX as U32_MAX;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/parse_time.rs"]
|
||||
mod parse_time;
|
||||
|
||||
static NAME: &'static str = "sleep";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
@ -68,7 +64,7 @@ specified by the sum of their values.", NAME, VERSION);
|
|||
|
||||
fn sleep(args: Vec<String>) {
|
||||
let sleep_time = args.iter().fold(0.0, |result, arg|
|
||||
match parse_time::from_str(&arg[..]) {
|
||||
match uucore::parse_time::from_str(&arg[..]) {
|
||||
Ok(m) => m + result,
|
||||
Err(f) => crash!(1, "{}", f),
|
||||
});
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "sort.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="sort"
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use libc::STDIN_FILENO;
|
||||
use libc::{c_int, isatty};
|
||||
use std::cmp::Ordering;
|
||||
|
@ -21,10 +24,6 @@ use std::fs::File;
|
|||
use std::io::{BufRead, BufReader, Read, stdin, Write};
|
||||
use std::path::Path;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "sort";
|
||||
static VERSION: &'static str = "0.0.1";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "split.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="split"
|
||||
|
|
|
@ -12,15 +12,14 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use std::char;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{BufRead, BufReader, BufWriter, Read, stdin, stdout, Write};
|
||||
use std::path::Path;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "split";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "stdbuf.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="stdbuf"
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use libc::{c_int, size_t, c_char, FILE, _IOFBF, _IONBF, _IOLBF, setvbuf};
|
||||
use std::env;
|
||||
use std::io::Write;
|
||||
use std::ptr;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
extern {
|
||||
static stdin: *mut FILE;
|
||||
static stdout: *mut FILE;
|
||||
|
|
|
@ -12,20 +12,15 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use getopts::{Matches, Options};
|
||||
use std::io::{self, Write};
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[path = "../common/filesystem.rs"]
|
||||
mod filesystem;
|
||||
|
||||
use filesystem::{canonicalize, CanonicalizeMode, UUPathExt};
|
||||
use uucore::fs::{canonicalize, CanonicalizeMode, UUPathExt};
|
||||
|
||||
static NAME: &'static str = "stdbuf";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
|
|
@ -10,6 +10,7 @@ path = "sum.rs"
|
|||
[dependencies]
|
||||
getopts = "*"
|
||||
libc = "*"
|
||||
uucore = { path="../uucore" }
|
||||
|
||||
[[bin]]
|
||||
name="sum"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue