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

Merge branch 'master' into expr-regex

This commit is contained in:
Ian Douglas Scott 2017-10-01 10:06:28 -07:00
commit 1a28a48ca3
No known key found for this signature in database
GPG key ID: 4924E10E199B5959
100 changed files with 2193 additions and 814 deletions

253
Cargo.lock generated
View file

@ -37,7 +37,7 @@ dependencies = [
"install 0.0.1", "install 0.0.1",
"kill 0.0.1", "kill 0.0.1",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"link 0.0.1", "link 0.0.1",
"ln 0.0.1", "ln 0.0.1",
"logname 0.0.1", "logname 0.0.1",
@ -82,7 +82,7 @@ dependencies = [
"tee 0.0.1", "tee 0.0.1",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"test 0.0.1", "test 0.0.1",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"timeout 0.0.1", "timeout 0.0.1",
"touch 0.0.1", "touch 0.0.1",
"tr 0.0.1", "tr 0.0.1",
@ -140,7 +140,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -150,7 +150,7 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -200,7 +200,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "1.0.0" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -212,9 +212,14 @@ dependencies = [
"uucore 0.0.1", "uucore 0.0.1",
] ]
[[package]]
name = "cc"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "0.1.1" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -229,7 +234,7 @@ dependencies = [
name = "chmod" name = "chmod"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
"walker 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "walker 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -248,8 +253,8 @@ name = "chrono"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"num 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -264,7 +269,7 @@ dependencies = [
name = "cksum" name = "cksum"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -286,10 +291,10 @@ dependencies = [
[[package]] [[package]]
name = "cmake" name = "cmake"
version = "0.1.24" version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -297,7 +302,7 @@ name = "comm"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -305,9 +310,17 @@ dependencies = [
name = "cp" name = "cp"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"clap 2.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
"filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"quick-error 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
"walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"xattr 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -343,7 +356,7 @@ dependencies = [
name = "dirname" name = "dirname"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -351,7 +364,7 @@ dependencies = [
name = "du" name = "du"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -371,7 +384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "env" name = "env"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -388,8 +401,8 @@ dependencies = [
name = "expr" name = "expr"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"onig 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "onig 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -410,14 +423,14 @@ name = "filetime"
version = "0.1.10" version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "fmt" name = "fmt"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -466,7 +479,7 @@ name = "hashsum"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
@ -478,7 +491,7 @@ dependencies = [
name = "head" name = "head"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -486,7 +499,7 @@ dependencies = [
name = "hostid" name = "hostid"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -494,7 +507,7 @@ dependencies = [
name = "hostname" name = "hostname"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -510,10 +523,15 @@ name = "install"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
[[package]]
name = "ioctl-sys"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.6.0" version = "0.6.0"
@ -535,7 +553,7 @@ dependencies = [
name = "kill" name = "kill"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -546,19 +564,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.24" version = "0.2.26"
source = "git+https://github.com/rust-lang/libc.git#83f5543e761bad58c1f061447c28df4a0201c761" source = "git+https://github.com/rust-lang/libc.git#c43c0770db6b85ade0b70009464603ff9be4b37d"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.24" version = "0.2.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "link" name = "link"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -566,7 +584,7 @@ dependencies = [
name = "ln" name = "ln"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -574,7 +592,7 @@ dependencies = [
name = "logname" name = "logname"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -587,7 +605,7 @@ dependencies = [
"pretty-bytes 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty-bytes 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"term_grid 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "term_grid 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"termsize 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "termsize 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -597,7 +615,7 @@ name = "memchr"
version = "1.0.1" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -605,7 +623,7 @@ name = "mkdir"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -614,7 +632,7 @@ name = "mkfifo"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -623,7 +641,7 @@ name = "mknod"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -659,7 +677,7 @@ name = "nice"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -669,8 +687,8 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -680,7 +698,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -692,7 +710,7 @@ name = "nohup"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -701,41 +719,41 @@ name = "nproc"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
[[package]] [[package]]
name = "num" name = "num"
version = "0.1.39" version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"num-integer 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num-iter 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "num-integer" name = "num-integer"
version = "0.1.34" version = "0.1.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "num-iter" name = "num-iter"
version = "0.1.33" version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"num-integer 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.1.39" version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -743,38 +761,38 @@ name = "num_cpus"
version = "1.6.2" version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "od" name = "od"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
[[package]] [[package]]
name = "onig" name = "onig"
version = "1.3.0" version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"onig_sys 63.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "onig_sys 65.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "onig_sys" name = "onig_sys"
version = "63.0.2" version = "65.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -791,7 +809,7 @@ name = "pathchk"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -813,7 +831,7 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -838,7 +856,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -863,7 +881,7 @@ name = "rand"
version = "0.3.15" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -871,7 +889,7 @@ name = "readlink"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -885,7 +903,7 @@ dependencies = [
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.1.19" version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -913,12 +931,23 @@ dependencies = [
"uucore 0.0.1", "uucore 0.0.1",
] ]
[[package]]
name = "remove_dir_all"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "rm" name = "rm"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"remove_dir_all 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
"walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -935,10 +964,10 @@ version = "0.2.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -995,9 +1024,9 @@ version = "0.0.1"
dependencies = [ dependencies = [
"filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -1041,7 +1070,7 @@ name = "stat"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -1072,7 +1101,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1091,7 +1120,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1101,7 +1130,7 @@ name = "tee"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -1119,7 +1148,7 @@ version = "2.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1139,7 +1168,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1150,7 +1179,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1158,7 +1187,7 @@ dependencies = [
name = "test" name = "test"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -1182,12 +1211,12 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.37" version = "0.1.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1196,8 +1225,8 @@ name = "timeout"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -1207,7 +1236,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -1246,7 +1275,7 @@ name = "tty"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -1294,8 +1323,8 @@ name = "unix_socket"
version = "0.5.0" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1303,7 +1332,7 @@ name = "unlink"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.1", "uucore 0.0.1",
] ]
@ -1342,8 +1371,8 @@ version = "0.0.1"
dependencies = [ dependencies = [
"data-encoding 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "data-encoding 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.24 (git+https://github.com/rust-lang/libc.git)", "libc 0.2.26 (git+https://github.com/rust-lang/libc.git)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1415,6 +1444,14 @@ name = "winapi-build"
version = "0.1.1" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "xattr"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "yes" name = "yes"
version = "0.0.1" version = "0.0.1"
@ -1433,11 +1470,12 @@ dependencies = [
"checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f" "checksum bit-vec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b4ff8b16e6076c3e14220b39fbc1fabb6737522281a388998046859400895f"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" "checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d"
"checksum cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c47d456a36ebf0536a6705c83c1cbbcb9255fbc1d905a6ded104f479268a29" "checksum cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7db2f146208d7e0fbee761b09cd65a7f51ccc38705d4e7262dad4d73b12a76b1"
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
"checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9" "checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9"
"checksum clap 2.25.0 (registry+https://github.com/rust-lang/crates.io-index)" = "867a885995b4184be051b70a592d4d70e32d7a188db6e8dff626af286a962771" "checksum clap 2.25.0 (registry+https://github.com/rust-lang/crates.io-index)" = "867a885995b4184be051b70a592d4d70e32d7a188db6e8dff626af286a962771"
"checksum cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ebbb35d3dc9cd09497168f33de1acb79b265d350ab0ac34133b98f8509af1f" "checksum cmake 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "357c07e7a1fc95732793c1edb5901e1a1f305cfcf63a90eb12dbd22bdb6b789d"
"checksum data-encoding 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d867ddbf09de0b73e09ec798972fb7f870495a0893f6f736c1855448c5a56789" "checksum data-encoding 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d867ddbf09de0b73e09ec798972fb7f870495a0893f6f736c1855448c5a56789"
"checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a" "checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a"
"checksum filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5363ab8e4139b8568a6237db5248646e5a8a2f89bd5ccb02092182b11fd3e922" "checksum filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5363ab8e4139b8568a6237db5248646e5a8a2f89bd5ccb02092182b11fd3e922"
@ -1446,27 +1484,29 @@ dependencies = [
"checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" "checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63d68db75012a85555434ee079e7e6337931f87a087ab2988becbadf64673a7f" "checksum half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63d68db75012a85555434ee079e7e6337931f87a087ab2988becbadf64673a7f"
"checksum ioctl-sys 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e2c4b26352496eaaa8ca7cfa9bd99e93419d3f7983dc6e99c2a35fe9e33504a"
"checksum itertools 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "772a0928a97246167d59a2a4729df5871f1327ab8b36fd24c4224b229cb47b99" "checksum itertools 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "772a0928a97246167d59a2a4729df5871f1327ab8b36fd24c4224b229cb47b99"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"
"checksum libc 0.2.24 (git+https://github.com/rust-lang/libc.git)" = "<none>" "checksum libc 0.2.26 (git+https://github.com/rust-lang/libc.git)" = "<none>"
"checksum libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)" = "38f5c2b18a287cf78b4097db62e20f43cace381dc76ae5c0a3073067f78b7ddc" "checksum libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "30885bcb161cf67054244d10d4a7f4835ffd58773bc72e07d35fecf472295503"
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" "checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487" "checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487"
"checksum num 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "2c3a3dc9f30bf824141521b30c908a859ab190b76e20435fcd89f35eb6583887" "checksum num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "a311b77ebdc5dd4cf6449d81e4135d9f0e3b153839ac90e648a8ef538f923525"
"checksum num-integer 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1a4bf6f9174aa5783a9b4cc892cacd11aebad6c69ad027a0b65c6ca5f8aa37" "checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba"
"checksum num-iter 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "f7d1891bd7b936f12349b7d1403761c8a0b85a18b148e9da4429d5d102c1a41e" "checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01"
"checksum num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "1708c0628602a98b52fad936cf3edb9a107af06e52e49fdf0707e884456a6af6" "checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0"
"checksum num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aec53c34f2d0247c5ca5d32cca1478762f301740468ee9ee6dcb7a0dd7a0c584" "checksum num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aec53c34f2d0247c5ca5d32cca1478762f301740468ee9ee6dcb7a0dd7a0c584"
"checksum onig 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee619da9cf707b167098e84fb00f10db61d5a662d1d29b59822bcac3a81553dd" "checksum onig 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1271a3f93197303deda8aedcd96ed2dbb908f61c0954ae70bf7a42f536dc35d7"
"checksum onig_sys 63.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "531682ab45a2cd40eff91f29340dae975f25336d2b61e624adabed39e61d7fb3" "checksum onig_sys 65.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fbdee58fb75f5b7749ebc8f601f570961eed595dfe4c2bb9a542e2f7ae20b946"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum pretty-bytes 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3095b93999fae14b4e0bb661c53875a441d9058b7b1a7ba2dfebc104d3776349" "checksum pretty-bytes 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3095b93999fae14b4e0bb661c53875a441d9058b7b1a7ba2dfebc104d3776349"
"checksum quick-error 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c36987d4978eb1be2e422b1e0423a557923a5c3e7e6f31d5699e9aafaefa469" "checksum quick-error 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c36987d4978eb1be2e422b1e0423a557923a5c3e7e6f31d5699e9aafaefa469"
"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d" "checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d"
"checksum redox_syscall 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "e4a357d14a12e90a37d658725df0e6468504750b5948b9710f83f94a0c5818e8" "checksum redox_syscall 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "9df6a71a1e67be2104410736b2389fb8e383c1d7e9e792d629ff13c02867147a"
"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b" "checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b"
"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db" "checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
"checksum remove_dir_all 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0882bc41b0ba6131c7f0ce97233b62d8099e3f3abc60d4938185d3e35439c0cc"
"checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a"
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
@ -1482,7 +1522,7 @@ dependencies = [
"checksum termsize 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3a225cb94c3630aabd2e289cad545679dd38b5f4891524e92da1be10aae6e4e8" "checksum termsize 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3a225cb94c3630aabd2e289cad545679dd38b5f4891524e92da1be10aae6e4e8"
"checksum textwrap 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f86300c3e7416ee233abd7cda890c492007a3980f941f79185c753a701257167" "checksum textwrap 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f86300c3e7416ee233abd7cda890c492007a3980f941f79185c753a701257167"
"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14" "checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"
"checksum time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "ffd7ccbf969a892bf83f1e441126968a07a3941c24ff522a26af9f9f4585d1a3" "checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520"
"checksum unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18127285758f0e2c6cf325bb3f3d138a12fee27de4f23e146cd6a179f26c2cf3" "checksum unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18127285758f0e2c6cf325bb3f3d138a12fee27de4f23e146cd6a179f26c2cf3"
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
"checksum unindent 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3508be0ce1bacc38d579b69bffb4b8d469f5af0c388ff4890b2b294e61671ffe" "checksum unindent 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3508be0ce1bacc38d579b69bffb4b8d469f5af0c388ff4890b2b294e61671ffe"
@ -1496,3 +1536,4 @@ dependencies = [
"checksum walker 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0488b82b198ac3588ba688f5e56cbd53e0b6dad64f075e67c15647e54aac610" "checksum walker 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0488b82b198ac3588ba688f5e56cbd53e0b6dad64f075e67c15647e54aac610"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum xattr 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "abb373b92de38a4301d66bec009929b4fb83120ea1c4a401be89dbe0b9777443"

View file

@ -238,17 +238,17 @@ whoami = { optional=true, path="src/whoami" }
yes = { optional=true, path="src/yes" } yes = { optional=true, path="src/yes" }
[dev-dependencies] [dev-dependencies]
time = "*" time = "0.1.38"
filetime = "*" filetime = "0.1.10"
libc = "*" libc = "0.2.26"
regex="*" regex = "0.2.2"
rand="*" rand = "0.3.15"
tempdir="*" tempdir = "0.3.5"
unindent="*" unindent = "0.1.0"
lazy_static = "*" lazy_static = "0.2.2"
[target.'cfg(unix)'.dev-dependencies] [target.'cfg(unix)'.dev-dependencies]
unix_socket = "*" unix_socket = "0.5.0"
[[bin]] [[bin]]
name = "uutils" name = "uutils"

193
README.md
View file

@ -4,6 +4,7 @@ uutils coreutils
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/uutils/coreutils/blob/master/LICENSE) [![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/uutils/coreutils/blob/master/LICENSE)
[![Build Status](https://api.travis-ci.org/uutils/coreutils.svg?branch=master)](https://travis-ci.org/uutils/coreutils) [![Build Status](https://api.travis-ci.org/uutils/coreutils.svg?branch=master)](https://travis-ci.org/uutils/coreutils)
[![Build status](https://ci.appveyor.com/api/projects/status/787ltcxgy86r20le?svg=true)](https://ci.appveyor.com/project/Arcterus/coreutils) [![Build status](https://ci.appveyor.com/api/projects/status/787ltcxgy86r20le?svg=true)](https://ci.appveyor.com/project/Arcterus/coreutils)
[![LOC](https://tokei.rs/b1/github/uutils/coreutils?category=code)](https://github.com/Aaronepower/tokei)
uutils is an attempt at writing universal (as in cross-platform) CLI uutils is an attempt at writing universal (as in cross-platform) CLI
utils in [Rust](http://www.rust-lang.org). This repo is to aggregate the GNU utils in [Rust](http://www.rust-lang.org). This repo is to aggregate the GNU
@ -144,110 +145,96 @@ Contribute
To contribute to coreutils, please see [CONTRIBUTING](CONTRIBUTING.md). To contribute to coreutils, please see [CONTRIBUTING](CONTRIBUTING.md).
To do Utilities
----- ---------
* [x] arch | Done | Semi-Done | To Do |
* [x] base32 |-----------|-----------|--------|
* [x] base64 | arch | cp | chcon |
* [x] basename | base32 | expr | csplit |
* [x] cat | base64 | install | dd |
* [ ] chcon | basename | ls | df |
* [x] chgrp | cat | more | join |
* [x] chmod | chgrp | od (`--strings` and 128-bit data types missing) | numfmt |
* [x] chown | chmod | printf | pr |
* [x] chroot | chown | sort | runcon |
* [x] cksum | chroot | split | stty |
* [x] comm | cksum | tail | |
* [ ] cp (not much done) | comm | test | |
* [ ] csplit | cut | date | |
* [x] cut | dircolors | | |
* [ ] date | dirname | | |
* [ ] dd | du | | |
* [ ] df | echo | | |
* [x] dircolors | env | | |
* [x] dirname | expand | | |
* [x] du | factor | | |
* [x] echo | false | | |
* [x] env | fmt | | |
* [x] expand | fold | | |
* [x] expr | groups | | |
* [x] factor | hashsum | | |
* [x] false | head | | |
* [x] fmt | hostid | | |
* [x] fold | hostname | | |
* [x] groups | id | | |
* [x] hashsum | kill | | |
* [x] head | link | | |
* [x] hostid | ln | | |
* [x] hostname | logname | | |
* [x] id | ~~md5sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs)) | |
* [ ] install (a couple of missing options) | ~~sha1sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs)) | |
* [ ] join | ~~sha224sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs)) | |
* [x] kill | ~~sha256sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs)) | |
* [x] link | ~~sha384sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs)) | |
* [x] ln | ~~sha512sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs)) | |
* [x] logname | mkdir | | |
* [ ] ls | mkfifo | | |
* [x] ~~md5sum~~, ~~sha1sum~~, ~~sha224sum~~, ~~sha256sum~~, ~~sha384sum~~, ~~sha512sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs)) | mknod | | |
* [x] mkdir | mktemp | | |
* [x] mkfifo | mv | | |
* [x] mknod | nice | | |
* [x] mktemp | nl | | |
* [x] mv | nohup | | |
* [ ] more (in progress, needs lots of work) | nproc | | |
* [x] nice | paste | | |
* [x] nl | pathchk | | |
* [x] nohup | pinky | | |
* [x] nproc | printenv | | |
* [ ] numfmt | ptx | | |
* [ ] od (almost complete, `--strings` and 128-bit datatypes are missing) | pwd | | |
* [x] paste | readlink | | |
* [x] pathchk | realpath | | |
* [x] pinky | relpath | | |
* [ ] pr | rm | | |
* [x] printenv | rmdir | | |
* [ ] printf | seq | | |
* [x] ptx | shred | | |
* [x] pwd | shuf | | |
* [x] readlink | sleep | | |
* [x] realpath | stat | | |
* [x] relpath | stdbuf | | |
* [x] rm | sum | | |
* [x] rmdir | sync | | |
* [ ] runcon | tac | | |
* [x] seq | tee | | |
* [x] shred | timeout | | |
* [x] shuf | touch | | |
* [x] sleep | tr | | |
* [ ] sort (a couple of options implemented) | true | | |
* [ ] split (a couple of missing options) | truncate | | |
* [x] stat | tsort | | |
* [x] stdbuf | tty | | |
* [ ] stty | uname | | |
* [x] sum | unexpand | | |
* [x] sync | uniq | | |
* [x] tac | unlink | | |
* [ ] tail (not all features implemented) | uptime | | |
* [x] tee | users | | |
* [ ] test (not all features implemented) | wc | | |
* [x] timeout | who | | |
* [x] touch | whoami | | |
* [x] tr | yes | | |
* [x] true
* [x] truncate
* [x] tsort
* [x] tty
* [x] uname
* [x] unexpand
* [x] uniq
* [x] unlink
* [x] uptime
* [x] users
* [x] wc
* [x] who
* [x] whoami
* [x] yes
License License
------- -------

View file

@ -11,7 +11,7 @@ path = "base32.rs"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[dependencies.clippy] [dependencies.clippy]
version = "*" version = "0.0.143"
optional = true optional = true
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_chgrp"
path = "chgrp.rs" path = "chgrp.rs"
[dependencies] [dependencies]
walkdir = "*" walkdir = "1.0.7"
[dependencies.uucore] [dependencies.uucore]
path = "../uucore" path = "../uucore"

View file

@ -8,9 +8,9 @@ name = "uu_chmod"
path = "chmod.rs" path = "chmod.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
walker = "*" walker = "1.0.0"
[[bin]] [[bin]]
name = "chmod" name = "chmod"

View file

@ -9,6 +9,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
#[cfg(unix)]
extern crate libc; extern crate libc;
extern crate walker; extern crate walker;
@ -16,9 +17,9 @@ extern crate walker;
extern crate uucore; extern crate uucore;
use std::error::Error; use std::error::Error;
use std::ffi::CString; use std::fs;
use std::io::{self, Write}; use std::io::Write;
use std::mem; use std::os::unix::fs::{MetadataExt, PermissionsExt};
use std::path::Path; use std::path::Path;
use walker::Walker; use walker::Walker;
@ -74,16 +75,10 @@ pub fn uumain(mut args: Vec<String>) -> i32 {
let verbose = matches.opt_present("verbose"); let verbose = matches.opt_present("verbose");
let preserve_root = matches.opt_present("preserve-root"); let preserve_root = matches.opt_present("preserve-root");
let recursive = matches.opt_present("recursive"); let recursive = matches.opt_present("recursive");
let fmode = matches.opt_str("reference").and_then(|fref| { let fmode = matches.opt_str("reference").and_then(|ref fref| {
let s = CString::new(fref).unwrap_or_else( |_| { match fs::metadata(fref) {
crash!(1, "reference file name contains internal nul byte") Ok(meta) => Some(meta.mode()),
}); Err(err) => crash!(1, "cannot stat attribues of '{}': {}", fref, err)
let mut stat : libc::stat = unsafe { mem::uninitialized() };
let statres = unsafe { libc::stat(s.as_ptr() as *const _, &mut stat as *mut libc::stat) };
if statres == 0 {
Some(stat.st_mode)
} else {
crash!(1, "cannot stat attribues of '{}': {}", matches.opt_str("reference").unwrap(), io::Error::last_os_error())
} }
}); });
let cmode = let cmode =
@ -108,7 +103,7 @@ pub fn uumain(mut args: Vec<String>) -> i32 {
0 0
} }
fn chmod(files: Vec<String>, changes: bool, quiet: bool, verbose: bool, preserve_root: bool, recursive: bool, fmode: Option<libc::mode_t>, cmode: Option<&String>) -> Result<(), i32> { fn chmod(files: Vec<String>, changes: bool, quiet: bool, verbose: bool, preserve_root: bool, recursive: bool, fmode: Option<u32>, cmode: Option<&String>) -> Result<(), i32> {
let mut r = Ok(()); let mut r = Ok(());
for filename in &files { for filename in &files {
@ -157,28 +152,25 @@ fn chmod(files: Vec<String>, changes: bool, quiet: bool, verbose: bool, preserve
} }
#[cfg(windows)] #[cfg(windows)]
fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool, fmode: Option<libc::mode_t>, cmode: Option<&String>) -> Result<(), i32> { fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool, fmode: Option<u32>, cmode: Option<&String>) -> Result<(), i32> {
// chmod is useless on Windows // chmod is useless on Windows
// it doesn't set any permissions at all // it doesn't set any permissions at all
// instead it just sets the readonly attribute on the file // instead it just sets the readonly attribute on the file
Err(0) Err(0)
} }
#[cfg(unix)] #[cfg(any(unix, target_os = "redox"))]
fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool, fmode: Option<libc::mode_t>, cmode: Option<&String>) -> Result<(), i32> { fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool, fmode: Option<u32>, cmode: Option<&String>) -> Result<(), i32> {
let path = CString::new(name).unwrap_or_else(|e| panic!("{}", e)); let mut fperm = match fs::metadata(name) {
let mut stat: libc::stat = unsafe { mem::uninitialized() }; Ok(meta) => meta.mode() & 0o7777,
let statres = unsafe { libc::stat(path.as_ptr(), &mut stat as *mut libc::stat) }; Err(err) => {
let mut fperm =
if statres == 0 {
stat.st_mode & 0o7777
} else {
if !quiet { if !quiet {
show_error!("{}", io::Error::last_os_error()); show_error!("{}", err);
} }
return Err(1); return Err(1);
}; }
};
match fmode { match fmode {
Some(mode) => try!(change_file(fperm, mode, file, &path, verbose, changes, quiet)), Some(mode) => try!(change_file(fperm, mode, file, name, verbose, changes, quiet)),
None => { None => {
for mode in cmode.unwrap().split(',') { // cmode is guaranteed to be Some in this case for mode in cmode.unwrap().split(',') { // cmode is guaranteed to be Some in this case
let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; let arr: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
@ -190,7 +182,7 @@ fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool
}; };
match result { match result {
Ok(mode) => { Ok(mode) => {
try!(change_file(fperm, mode, file, &path, verbose, changes, quiet)); try!(change_file(fperm, mode, file, name, verbose, changes, quiet));
fperm = mode; fperm = mode;
} }
Err(f) => { Err(f) => {
@ -207,13 +199,13 @@ fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool
Ok(()) Ok(())
} }
fn parse_numeric(fperm: libc::mode_t, mut mode: &str) -> Result<libc::mode_t, String> { fn parse_numeric(fperm: u32, mut mode: &str) -> Result<u32, String> {
let (op, pos) = try!(parse_op(mode, Some('='))); let (op, pos) = try!(parse_op(mode, Some('=')));
mode = mode[pos..].trim_left_matches('0'); mode = mode[pos..].trim_left_matches('0');
if mode.len() > 4 { if mode.len() > 4 {
Err(format!("mode is too large ({} > 7777)", mode)) Err(format!("mode is too large ({} > 7777)", mode))
} else { } else {
match libc::mode_t::from_str_radix(mode, 8) { match u32::from_str_radix(mode, 8) {
Ok(change) => { Ok(change) => {
Ok(match op { Ok(match op {
'+' => fperm | change, '+' => fperm | change,
@ -227,14 +219,23 @@ fn parse_numeric(fperm: libc::mode_t, mut mode: &str) -> Result<libc::mode_t, St
} }
} }
fn parse_symbolic(mut fperm: libc::mode_t, mut mode: &str, file: &Path) -> Result<libc::mode_t, String> { fn parse_symbolic(mut fperm: u32, mut mode: &str, file: &Path) -> Result<u32, String> {
#[cfg(unix)]
use libc::umask;
#[cfg(target_os = "redox")]
unsafe fn umask(_mask: u32) -> u32 {
// XXX Redox does not currently have umask
0
}
let (mask, pos) = parse_levels(mode); let (mask, pos) = parse_levels(mode);
if pos == mode.len() { if pos == mode.len() {
return Err(format!("invalid mode ({})", mode)); return Err(format!("invalid mode ({})", mode));
} }
let respect_umask = pos == 0; let respect_umask = pos == 0;
let last_umask = unsafe { let last_umask = unsafe {
libc::umask(0) umask(0)
}; };
mode = &mode[pos..]; mode = &mode[pos..];
while mode.len() > 0 { while mode.len() > 0 {
@ -242,7 +243,7 @@ fn parse_symbolic(mut fperm: libc::mode_t, mut mode: &str, file: &Path) -> Resul
mode = &mode[pos..]; mode = &mode[pos..];
let (mut srwx, pos) = parse_change(mode, fperm, file); let (mut srwx, pos) = parse_change(mode, fperm, file);
if respect_umask { if respect_umask {
srwx &= !last_umask; srwx &= !(last_umask as u32);
} }
mode = &mode[pos..]; mode = &mode[pos..];
match op { match op {
@ -253,12 +254,12 @@ fn parse_symbolic(mut fperm: libc::mode_t, mut mode: &str, file: &Path) -> Resul
} }
} }
unsafe { unsafe {
libc::umask(last_umask); umask(last_umask);
} }
Ok(fperm) Ok(fperm)
} }
fn parse_levels(mode: &str) -> (libc::mode_t, usize) { fn parse_levels(mode: &str) -> (u32, usize) {
let mut mask = 0; let mut mask = 0;
let mut pos = 0; let mut pos = 0;
for ch in mode.chars() { for ch in mode.chars() {
@ -290,7 +291,7 @@ fn parse_op(mode: &str, default: Option<char>) -> Result<(char, usize), String>
} }
} }
fn parse_change(mode: &str, fperm: libc::mode_t, file: &Path) -> (libc::mode_t, usize) { fn parse_change(mode: &str, fperm: u32, file: &Path) -> (u32, usize) {
let mut srwx = fperm & 0o7000; let mut srwx = fperm & 0o7000;
let mut pos = 0; let mut pos = 0;
for ch in mode.chars() { for ch in mode.chars() {
@ -318,24 +319,24 @@ fn parse_change(mode: &str, fperm: libc::mode_t, file: &Path) -> (libc::mode_t,
(srwx, pos) (srwx, pos)
} }
fn change_file(fperm: libc::mode_t, mode: libc::mode_t, file: &Path, path: &CString, verbose: bool, changes: bool, quiet: bool) -> Result<(), i32> { fn change_file(fperm: u32, mode: u32, file: &Path, path: &str, verbose: bool, changes: bool, quiet: bool) -> Result<(), i32> {
if fperm == mode { if fperm == mode {
if verbose && !changes { if verbose && !changes {
show_info!("mode of '{}' retained as {:o}", file.display(), fperm); show_info!("mode of '{}' retained as {:o}", file.display(), fperm);
} }
Ok(()) Ok(())
} else if unsafe { libc::chmod(path.as_ptr(), mode) } == 0 { } else if let Err(err) = fs::set_permissions(Path::new(path), fs::Permissions::from_mode(mode)) {
if verbose || changes {
show_info!("mode of '{}' changed from {:o} to {:o}", file.display(), fperm, mode);
}
Ok(())
} else {
if !quiet { if !quiet {
show_error!("{}", io::Error::last_os_error()); show_error!("{}", err);
} }
if verbose { if verbose {
show_info!("failed to change mode of file '{}' from {:o} to {:o}", file.display(), fperm, mode); show_info!("failed to change mode of file '{}' from {:o} to {:o}", file.display(), fperm, mode);
} }
return Err(1); Err(1)
} else {
if verbose || changes {
show_info!("mode of '{}' changed from {:o} to {:o}", file.display(), fperm, mode);
}
Ok(())
} }
} }

View file

@ -8,7 +8,7 @@ name = "uu_chown"
path = "chown.rs" path = "chown.rs"
[dependencies] [dependencies]
glob = "*" glob = "0.2.11"
walkdir = "0.1" walkdir = "0.1"
[dependencies.uucore] [dependencies.uucore]
@ -17,7 +17,7 @@ default-features = false
features = ["entries", "fs"] features = ["entries", "fs"]
[dependencies.clippy] [dependencies.clippy]
version = "*" version = "0.0.143"
optional = true optional = true
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_chroot"
path = "chroot.rs" path = "chroot.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
[dependencies.uucore] [dependencies.uucore]
path = "../uucore" path = "../uucore"

View file

@ -8,7 +8,7 @@ name = "uu_cksum"
path = "cksum.rs" path = "cksum.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_comm"
path = "comm.rs" path = "comm.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -1,16 +1,33 @@
[package] [package]
name = "cp" name = "cp"
version = "0.0.1" version = "0.0.1"
authors = [] authors = [
"Jordy Dickinson <jordy.dickinson@gmail.com>",
"Joshua S. Miller <jsmiller@uchicago.edu>",
]
[lib] [lib]
name = "uu_cp" name = "uu_cp"
path = "cp.rs" path = "cp.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
walkdir = "1.0.7"
clap = "2.20.0"
quick-error = "1.1.0"
uucore = { path="../uucore" } uucore = { path="../uucore" }
filetime = "0.1"
[target.'cfg(target_os = "linux")'.dependencies]
ioctl-sys = "0.5.2"
[target.'cfg(target_os = "windows")'.dependencies]
kernel32-sys = "*"
winapi = "*"
[target.'cfg(unix)'.dependencies]
xattr="0.2.1"
[[bin]] [[bin]]
name = "cp" name = "cp"

38
src/cp/README.md Normal file
View file

@ -0,0 +1,38 @@
## Feature list
### To Do
- [ ] archive
- [ ] attributes-only
- [ ] copy-contents
- [ ] no-dereference-preserve-linkgs
- [ ] dereference
- [ ] no-dereference
- [ ] preserve-default-attributes
- [ ] preserve
- [ ] no-preserve
- [ ] parents
- [ ] reflink
- [ ] sparse
- [ ] strip-trailing-slashes
- [ ] update
- [ ] one-file-system
- [ ] context
- [ ] cli-symbolic-links
### Completed
- [x] backup
- [x] force (Not implemented on Windows)
- [x] interactive
- [x] link
- [x] no-clobber
- [x] no-target-directory
- [x] paths
- [x] recursive
- [x] remove-destination (On Windows, current only works for writeable files)
- [x] suffix
- [x] symbolic-link
- [x] target-directory
- [x] verbose
- [x] version

File diff suppressed because it is too large Load diff

View file

@ -8,8 +8,8 @@ name = "uu_date"
path = "date.rs" path = "date.rs"
[dependencies] [dependencies]
chrono = "0.4" chrono = "0.4.0"
clap = "2.25" clap = "2.24.1"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -1,4 +1,4 @@
extern crate uu_echo; extern crate uu_date;
fn main() { fn main() {
std::process::exit(uu_date::uumain(std::env::args().collect())); std::process::exit(uu_date::uumain(std::env::args().collect()));

View file

@ -8,7 +8,7 @@ name = "uu_dircolors"
path = "dircolors.rs" path = "dircolors.rs"
[dependencies] [dependencies]
glob = "*" glob = "0.2.11"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_dirname"
path = "dirname.rs" path = "dirname.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_du"
path = "du.rs" path = "du.rs"
[dependencies] [dependencies]
time = "*" time = "0.1.38"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

2
src/env/Cargo.toml vendored
View file

@ -8,7 +8,7 @@ name = "uu_env"
path = "env.rs" path = "env.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_expand"
path = "expand.rs" path = "expand.rs"
[dependencies] [dependencies]
unicode-width = "*" unicode-width = "0.1.4"
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_expr"
path = "expr.rs" path = "expr.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
onig = "1.3" onig = "1.3.0"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_factor"
path = "factor.rs" path = "factor.rs"
[dependencies] [dependencies]
rand = "*" rand = "0.3.15"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_fmt"
path = "fmt.rs" path = "fmt.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
unicode-width = "*" unicode-width = "0.1.4"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,12 +8,12 @@ name = "uu_hashsum"
path = "hashsum.rs" path = "hashsum.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
regex = "*" regex = "0.2.2"
regex-syntax = "*" regex-syntax = "0.4.1"
rust-crypto = "*" rust-crypto = "0.2.36"
rustc-serialize = "*" rustc-serialize = "0.3.24"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_head"
path = "head.rs" path = "head.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_hostid"
path = "hostid.rs" path = "hostid.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_hostname"
path = "hostname.rs" path = "hostname.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,12 +8,12 @@ name = "uu_install"
path = "install.rs" path = "install.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = ">= 0.2" libc = ">= 0.2"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[dev-dependencies] [dev-dependencies]
time = "*" time = "0.1.38"
[[bin]] [[bin]]
name = "install" name = "install"

View file

@ -27,12 +27,12 @@ static SUMMARY: &'static str = "Copy SOURCE to DEST or multiple SOURCE(s) to the
DIRECTORY, while setting permission modes and owner/group"; DIRECTORY, while setting permission modes and owner/group";
static LONG_HELP: &'static str = ""; static LONG_HELP: &'static str = "";
const DEFAULT_MODE: libc::mode_t = 755; const DEFAULT_MODE: u32 = 755;
#[allow(dead_code)] #[allow(dead_code)]
pub struct Behaviour { pub struct Behaviour {
main_function: MainFunction, main_function: MainFunction,
specified_mode: Option<libc::mode_t>, specified_mode: Option<u32>,
suffix: String, suffix: String,
verbose: bool verbose: bool
} }
@ -47,7 +47,7 @@ pub enum MainFunction {
impl Behaviour { impl Behaviour {
/// Determine the mode for chmod after copy. /// Determine the mode for chmod after copy.
pub fn mode(&self) -> libc::mode_t { pub fn mode(&self) -> u32 {
match self.specified_mode { match self.specified_mode {
Some(x) => x, Some(x) => x,
None => DEFAULT_MODE None => DEFAULT_MODE
@ -138,8 +138,7 @@ fn parse_opts(args: Vec<String>) -> getopts::Matches {
DIRECTORY", "DIRECTORY") DIRECTORY", "DIRECTORY")
// TODO implement flag // TODO implement flag
.optflag("T", "no-target-directory", "(unimplemented) treat DEST as a normal file") .optflag("T", "no-target-directory", "(unimplemented) treat DEST as a normal file")
// TODO implement flag .optflag("v", "verbose", "explain what is being done")
.optflag("v", "verbose", "(unimplemented) explain what is being done")
// TODO implement flag // TODO implement flag
.optflag("P", "preserve-context", "(unimplemented) preserve security context") .optflag("P", "preserve-context", "(unimplemented) preserve security context")
// TODO implement flag // TODO implement flag
@ -181,8 +180,6 @@ fn check_unimplemented(matches: &getopts::Matches) -> Result<(), &str> {
Err("--target-directory, -t") Err("--target-directory, -t")
} else if matches.opt_present("no-target-directory") { } else if matches.opt_present("no-target-directory") {
Err("--no-target-directory, -T") Err("--no-target-directory, -T")
} else if matches.opt_present("verbose") {
Err("--verbose, -v")
} else if matches.opt_present("preserve-context") { } else if matches.opt_present("preserve-context") {
Err("--preserve-context, -P") Err("--preserve-context, -P")
} else if matches.opt_present("context") { } else if matches.opt_present("context") {
@ -209,7 +206,7 @@ fn behaviour(matches: &getopts::Matches) -> Result<Behaviour, i32> {
let considering_dir: bool = MainFunction::Directory == main_function; let considering_dir: bool = MainFunction::Directory == main_function;
let specified_mode: Option<libc::mode_t> = if matches.opt_present("mode") { let specified_mode: Option<u32> = if matches.opt_present("mode") {
match matches.opt_str("mode") { match matches.opt_str("mode") {
Some(x) => { Some(x) => {
match mode::parse(&x[..], considering_dir) { match mode::parse(&x[..], considering_dir) {
@ -367,7 +364,7 @@ fn copy(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> Result<(), ()> {
} }
if b.verbose { if b.verbose {
print!("{} -> {}", from.display(), to.display()); show_info!("'{}' -> '{}'", from.display(), to.display());
} }
Ok(()) Ok(())

View file

@ -2,9 +2,10 @@ extern crate libc;
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
use std::fs;
/// Takes a user-supplied string and tries to parse to u16 mode bitmask. /// Takes a user-supplied string and tries to parse to u16 mode bitmask.
pub fn parse(mode_string: &str, considering_dir: bool) -> Result<libc::mode_t, String> { pub fn parse(mode_string: &str, considering_dir: bool) -> Result<u32, String> {
let numbers: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; let numbers: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
// Passing 000 as the existing permissions seems to mirror GNU behaviour. // Passing 000 as the existing permissions seems to mirror GNU behaviour.
@ -19,21 +20,12 @@ pub fn parse(mode_string: &str, considering_dir: bool) -> Result<libc::mode_t, S
/// ///
/// Adapted from mkdir.rs. Handles own error printing. /// Adapted from mkdir.rs. Handles own error printing.
/// ///
#[cfg(unix)] #[cfg(any(unix, target_os = "redox"))]
pub fn chmod(path: &Path, mode: libc::mode_t) -> Result<(), ()> { pub fn chmod(path: &Path, mode: u32) -> Result<(), ()> {
use std::ffi::CString; use std::os::unix::fs::PermissionsExt;
use std::io::Error; fs::set_permissions(path, fs::Permissions::from_mode(mode)).map_err(|err| {
show_info!("{}: chmod failed with error {}", path.display(), err);
let file = CString::new(path.as_os_str().to_str().unwrap()). })
unwrap_or_else(|e| crash!(1, "{}", e));
let mode = mode as libc::mode_t;
if unsafe { libc::chmod(file.as_ptr(), mode) } != 0 {
show_info!("{}: chmod failed with errno {}", path.display(),
Error::last_os_error().raw_os_error().unwrap());
return Err(());
}
Ok(())
} }
/// chmod a file or directory on Windows. /// chmod a file or directory on Windows.
@ -41,7 +33,7 @@ pub fn chmod(path: &Path, mode: libc::mode_t) -> Result<(), ()> {
/// Adapted from mkdir.rs. /// Adapted from mkdir.rs.
/// ///
#[cfg(windows)] #[cfg(windows)]
pub fn chmod(path: &Path, mode: libc::mode_t) -> Result<(), ()> { pub fn chmod(path: &Path, mode: u32) -> Result<(), ()> {
// chmod on Windows only sets the readonly flag, which isn't even honored on directories // chmod on Windows only sets the readonly flag, which isn't even honored on directories
Ok(()) Ok(())
} }
@ -53,13 +45,13 @@ pub fn chmod(path: &Path, mode: libc::mode_t) -> Result<(), ()> {
mod chmod_rs { mod chmod_rs {
extern crate libc; extern crate libc;
pub fn parse_numeric(fperm: libc::mode_t, mut mode: &str) -> Result<libc::mode_t, String> { pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result<u32, String> {
let (op, pos) = try!(parse_op(mode, Some('='))); let (op, pos) = try!(parse_op(mode, Some('=')));
mode = mode[pos..].trim_left_matches('0'); mode = mode[pos..].trim_left_matches('0');
if mode.len() > 4 { if mode.len() > 4 {
Err(format!("mode is too large ({} > 7777)", mode)) Err(format!("mode is too large ({} > 7777)", mode))
} else { } else {
match libc::mode_t::from_str_radix(mode, 8) { match u32::from_str_radix(mode, 8) {
Ok(change) => { Ok(change) => {
Ok(match op { Ok(match op {
'+' => fperm | change, '+' => fperm | change,
@ -73,14 +65,23 @@ mod chmod_rs {
} }
} }
pub fn parse_symbolic(mut fperm: libc::mode_t, mut mode: &str, considering_dir: bool) -> Result<libc::mode_t, String> { pub fn parse_symbolic(mut fperm: u32, mut mode: &str, considering_dir: bool) -> Result<u32, String> {
#[cfg(unix)]
use libc::umask;
#[cfg(target_os = "redox")]
unsafe fn umask(_mask: u32) -> u32 {
// XXX Redox does not currently have umask
0
}
let (mask, pos) = parse_levels(mode); let (mask, pos) = parse_levels(mode);
if pos == mode.len() { if pos == mode.len() {
return Err(format!("invalid mode ({})", mode)); return Err(format!("invalid mode ({})", mode));
} }
let respect_umask = pos == 0; let respect_umask = pos == 0;
let last_umask = unsafe { let last_umask = unsafe {
libc::umask(0) umask(0)
}; };
mode = &mode[pos..]; mode = &mode[pos..];
while mode.len() > 0 { while mode.len() > 0 {
@ -88,7 +89,7 @@ mod chmod_rs {
mode = &mode[pos..]; mode = &mode[pos..];
let (mut srwx, pos) = parse_change(mode, fperm, considering_dir); let (mut srwx, pos) = parse_change(mode, fperm, considering_dir);
if respect_umask { if respect_umask {
srwx &= !last_umask; srwx &= !(last_umask as u32);
} }
mode = &mode[pos..]; mode = &mode[pos..];
match op { match op {
@ -99,12 +100,12 @@ mod chmod_rs {
} }
} }
unsafe { unsafe {
libc::umask(last_umask); umask(last_umask);
} }
Ok(fperm) Ok(fperm)
} }
fn parse_levels(mode: &str) -> (libc::mode_t, usize) { fn parse_levels(mode: &str) -> (u32, usize) {
let mut mask = 0; let mut mask = 0;
let mut pos = 0; let mut pos = 0;
for ch in mode.chars() { for ch in mode.chars() {
@ -136,7 +137,7 @@ mod chmod_rs {
} }
} }
fn parse_change(mode: &str, fperm: libc::mode_t, considering_dir: bool) -> (libc::mode_t, usize) { fn parse_change(mode: &str, fperm: u32, considering_dir: bool) -> (u32, usize) {
let mut srwx = fperm & 0o7000; let mut srwx = fperm & 0o7000;
let mut pos = 0; let mut pos = 0;
for ch in mode.chars() { for ch in mode.chars() {

View file

@ -8,7 +8,7 @@ name = "uu_kill"
path = "kill.rs" path = "kill.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_link"
path = "link.rs" path = "link.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_ln"
path = "ln.rs" path = "ln.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_logname"
path = "logname.rs" path = "logname.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,13 +8,13 @@ name = "uu_ls"
path = "ls.rs" path = "ls.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
pretty-bytes = "*" pretty-bytes = "0.2.1"
term_grid = "*" term_grid = "0.1.5"
termsize = "*" termsize = "0.1.4"
time = "*" time = "0.1.38"
lazy_static = "*" lazy_static = "0.2.8"
unicode-width = "*" unicode-width = "0.1.4"
[dependencies.uucore] [dependencies.uucore]
path = "../uucore" path = "../uucore"

View file

@ -31,10 +31,11 @@ use std::fs;
use std::fs::{DirEntry, FileType, Metadata}; use std::fs::{DirEntry, FileType, Metadata};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::io::Write; use std::io::Write;
use std::cmp::Reverse;
#[cfg(unix)] #[cfg(unix)]
use std::collections::HashMap; use std::collections::HashMap;
#[cfg(unix)] #[cfg(any(unix, target_os = "redox"))]
use std::os::unix::fs::MetadataExt; use std::os::unix::fs::MetadataExt;
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::fs::FileTypeExt; use std::os::unix::fs::FileTypeExt;
@ -44,13 +45,13 @@ use unicode_width::UnicodeWidthStr;
#[cfg(windows)] #[cfg(windows)]
use std::os::windows::fs::MetadataExt; use std::os::windows::fs::MetadataExt;
static NAME: &'static str = "ls"; static NAME: &'static str = "ls";
static SUMMARY: &'static str = ""; static SUMMARY: &'static str = "";
static LONG_HELP: &'static str = " static LONG_HELP: &'static str = "
By default, ls will list the files and contents of any directories on By default, ls will list the files and contents of any directories on
the command line, expect that it will ignore files and directories the command line, expect that it will ignore files and directories
whose names start with '.' whose names start with '.'
"; ";
#[cfg(unix)] #[cfg(unix)]
static DEFAULT_COLORS: &'static str = "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:"; static DEFAULT_COLORS: &'static str = "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:";
@ -183,17 +184,22 @@ fn list(options: getopts::Matches) {
} }
} }
#[cfg(unix)] #[cfg(any(unix, target_os = "redox"))]
fn sort_entries(entries: &mut Vec<PathBuf>, options: &getopts::Matches) { fn sort_entries(entries: &mut Vec<PathBuf>, options: &getopts::Matches) {
let mut reverse = options.opt_present("r"); let mut reverse = options.opt_present("r");
if options.opt_present("t") { if options.opt_present("t") {
if options.opt_present("c") { if options.opt_present("c") {
entries.sort_by_key(|k| get_metadata(k, options).map(|md| md.ctime()).unwrap_or(0)); entries.sort_by_key(|k| {
Reverse(get_metadata(k, options)
.map(|md| md.ctime())
.unwrap_or(0))
});
} else { } else {
entries.sort_by_key(|k| { entries.sort_by_key(|k| {
get_metadata(k, options) // Newest first
Reverse(get_metadata(k, options)
.and_then(|md| md.modified()) .and_then(|md| md.modified())
.unwrap_or(std::time::UNIX_EPOCH) .unwrap_or(std::time::UNIX_EPOCH))
}); });
} }
} else if options.opt_present("S") { } else if options.opt_present("S") {
@ -213,9 +219,10 @@ fn sort_entries(entries: &mut Vec<PathBuf>, options: &getopts::Matches) {
let mut reverse = options.opt_present("r"); let mut reverse = options.opt_present("r");
if options.opt_present("t") { if options.opt_present("t") {
entries.sort_by_key(|k| { entries.sort_by_key(|k| {
get_metadata(k, options) // Newest first
Reverse(get_metadata(k, options)
.and_then(|md| md.modified()) .and_then(|md| md.modified())
.unwrap_or(std::time::UNIX_EPOCH) .unwrap_or(std::time::UNIX_EPOCH))
}); });
} else if options.opt_present("S") { } else if options.opt_present("S") {
entries.sort_by_key(|k| get_metadata(k, options).map(|md| md.file_size()).unwrap_or(0)); entries.sort_by_key(|k| get_metadata(k, options).map(|md| md.file_size()).unwrap_or(0));

View file

@ -8,8 +8,8 @@ name = "uu_mkdir"
path = "mkdir.rs" path = "mkdir.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_mkfifo"
path = "mkfifo.rs" path = "mkfifo.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_mknod"
path = "mknod.rs" path = "mknod.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "^0.2.4" libc = "^0.2.4"
uucore = { path="../uucore" } uucore = { path="../uucore" }

View file

@ -9,9 +9,9 @@ path = "mktemp.rs"
[dependencies] [dependencies]
uucore = { path="../uucore" } uucore = { path="../uucore" }
getopts = "*" getopts = "0.2.14"
rand = "0.3" rand = "0.3"
tempfile = "*" tempfile = "2.1.5"
[[bin]] [[bin]]
name = "mktemp" name = "mktemp"

View file

@ -11,7 +11,7 @@ use std::path::Path;
// enough that an attacker will run out of luck before we run out of patience. // enough that an attacker will run out of luck before we run out of patience.
const NUM_RETRIES: u32 = 1 << 31; const NUM_RETRIES: u32 = 1 << 31;
#[cfg(unix)] #[cfg(any(unix, target_os = "redox"))]
fn create_dir<P: AsRef<Path>>(path: P) -> IOResult<()> { fn create_dir<P: AsRef<Path>>(path: P) -> IOResult<()> {
use std::fs::DirBuilder; use std::fs::DirBuilder;
use std::os::unix::fs::DirBuilderExt; use std::os::unix::fs::DirBuilderExt;

View file

@ -8,11 +8,11 @@ name = "uu_more"
path = "more.rs" path = "more.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[target.'cfg(all(unix, not(target_os = "fuchsia")))'.dependencies] [target.'cfg(all(unix, not(target_os = "fuchsia")))'.dependencies]
nix = "*" nix = "0.8.1"
[[bin]] [[bin]]
name = "more" name = "more"

View file

@ -8,7 +8,7 @@ name = "uu_mv"
path = "mv.rs" path = "mv.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_nice"
path = "nice.rs" path = "nice.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,12 +8,12 @@ name = "uu_nl"
path = "nl.rs" path = "nl.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
aho-corasick = "*" aho-corasick = "0.6.3"
memchr = "*" memchr = "1.0.1"
regex = "*" regex = "0.2.2"
regex-syntax = "*" regex-syntax = "0.4.1"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_nohup"
path = "nohup.rs" path = "nohup.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_nproc"
path = "nproc.rs" path = "nproc.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
num_cpus = "1.5" num_cpus = "1.5"
uucore = { path="../uucore" } uucore = { path="../uucore" }

View file

@ -8,10 +8,10 @@ name = "uu_od"
path = "od.rs" path = "od.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
byteorder = "*" byteorder = "1.1.0"
half = "*" half = "1.0.0"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_paste"
path = "paste.rs" path = "paste.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_pathchk"
path = "pathchk.rs" path = "pathchk.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_printenv"
path = "printenv.rs" path = "printenv.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_printf"
path = "printf.rs" path = "printf.rs"
[dependencies] [dependencies]
"itertools" = "*" "itertools" = "0.6.0"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -3,13 +3,12 @@
#![allow(dead_code)] #![allow(dead_code)]
extern crate itertools; extern crate itertools;
extern crate uucore;
mod cli; mod cli;
mod memo; mod memo;
mod tokenize; mod tokenize;
#[macro_use]
extern crate uucore;
static NAME: &'static str = "printf"; static NAME: &'static str = "printf";
static VERSION: &'static str = "0.0.1"; static VERSION: &'static str = "0.0.1";
@ -39,12 +38,12 @@ static LONGHELP_BODY: &'static str = "
ESCAPE SEQUENCES ESCAPE SEQUENCES
The following escape sequences, organized here in alphabetical order, The following escape sequences, organized here in alphabetical order,
will print the corresponding character literal: will print the corresponding character literal:
\" double quote \" double quote
\\\\ backslash \\\\ backslash
\\a alert (BEL) \\a alert (BEL)
\\b backspace \\b backspace
@ -64,7 +63,7 @@ static LONGHELP_BODY: &'static str = "
\\v vertical tab \\v vertical tab
\\NNN byte with value expressed in octal value NNN (1 to 3 digits) \\NNN byte with value expressed in octal value NNN (1 to 3 digits)
values greater than 256 will be treated values greater than 256 will be treated
\\xHH byte with value expressed in hexadecimal value NN (1 to 2 digits) \\xHH byte with value expressed in hexadecimal value NN (1 to 2 digits)
@ -80,14 +79,14 @@ static LONGHELP_BODY: &'static str = "
Fields Fields
%s - string %s - string
%b - string parsed for literals %b - string parsed for literals
second parameter is max length second parameter is max length
%c - char %c - char
no second parameter no second parameter
%i or %d - 64-bit integer %i or %d - 64-bit integer
%u - 64 bit unsigned integer %u - 64 bit unsigned integer
%x or %X - 64-bit unsigned integer as hex %x or %X - 64-bit unsigned integer as hex
%o - 64-bit unsigned integer as octal %o - 64-bit unsigned integer as octal
@ -97,7 +96,7 @@ static LONGHELP_BODY: &'static str = "
%f or %F - decimal floating point value %f or %F - decimal floating point value
%e or %E - scientific notation floating point value %e or %E - scientific notation floating point value
%g or %G - shorter of specially interpreted decimal or SciNote floating point value. %g or %G - shorter of specially interpreted decimal or SciNote floating point value.
second parameter is second parameter is
-max places after decimal point for floating point output -max places after decimal point for floating point output
-max number of significant digits for scientific notation output -max number of significant digits for scientific notation output
@ -108,7 +107,7 @@ static LONGHELP_BODY: &'static str = "
printf '%4.3i' 7 printf '%4.3i' 7
has a first parameter of 4 has a first parameter of 4
and a second parameter of 3 and a second parameter of 3
will result in ' 007' will result in ' 007'
printf '%.1s' abcde printf '%.1s' abcde
has no first parameter has no first parameter
@ -121,7 +120,7 @@ static LONGHELP_BODY: &'static str = "
will result in ' q' will result in ' q'
The first parameter of a field is the minimum width to pad the output to The first parameter of a field is the minimum width to pad the output to
if the output is less than this absolute value of this width, if the output is less than this absolute value of this width,
it will be padded with leading spaces, or, if the argument is negative, it will be padded with leading spaces, or, if the argument is negative,
with trailing spaces. the default is zero. with trailing spaces. the default is zero.
@ -132,7 +131,7 @@ static LONGHELP_BODY: &'static str = "
0 (e.g. 010) - interpret argument as octal (integer output fields only) 0 (e.g. 010) - interpret argument as octal (integer output fields only)
0x (e.g. 0xABC) - interpret argument as hex (numeric output fields only) 0x (e.g. 0xABC) - interpret argument as hex (numeric output fields only)
\' (e.g. \'a) - interpret argument as a character constant \' (e.g. \'a) - interpret argument as a character constant
HOW TO USE SUBSTITUTIONS HOW TO USE SUBSTITUTIONS
Substitutions are used to pass additional argument(s) into the FORMAT string, to be formatted a Substitutions are used to pass additional argument(s) into the FORMAT string, to be formatted a
@ -140,14 +139,14 @@ static LONGHELP_BODY: &'static str = "
printf 'the letter %X comes before the letter %X' 10 11 printf 'the letter %X comes before the letter %X' 10 11
will print will print
'the letter A comes before the letter B' 'the letter A comes before the letter B'
because the substitution field %X means because the substitution field %X means
'take an integer argument and write it as a hexadecimal number' 'take an integer argument and write it as a hexadecimal number'
Passing more arguments than are in the format string will cause the format string to be Passing more arguments than are in the format string will cause the format string to be
repeated for the remaining substitutions repeated for the remaining substitutions
printf 'it is %i F in %s \n' 22 Portland 25 Boston 27 New York printf 'it is %i F in %s \n' 22 Portland 25 Boston 27 New York
@ -160,18 +159,18 @@ static LONGHELP_BODY: &'static str = "
' '
If a format string is printed but there are less arguments remaining If a format string is printed but there are less arguments remaining
than there are substitution fields, substitution fields without than there are substitution fields, substitution fields without
an argument will default to empty strings, or for numeric fields an argument will default to empty strings, or for numeric fields
the value 0 the value 0
AVAILABLE SUBSTITUTIONS AVAILABLE SUBSTITUTIONS
This program, like GNU coreutils printf, This program, like GNU coreutils printf,
interprets a modified subset of the POSIX C printf spec, interprets a modified subset of the POSIX C printf spec,
a quick reference to substitutions is below. a quick reference to substitutions is below.
STRING SUBSTITUTIONS STRING SUBSTITUTIONS
All string fields have a 'max width' parameter All string fields have a 'max width' parameter
%.3s means 'print no more than three characters of the original input' %.3s means 'print no more than three characters of the original input'
%s - string %s - string
@ -193,7 +192,7 @@ static LONGHELP_BODY: &'static str = "
%.4i means an integer which if it is less than 4 digits in length, %.4i means an integer which if it is less than 4 digits in length,
is padded with leading zeros until it is 4 digits in length. is padded with leading zeros until it is 4 digits in length.
%d or %i - 64-bit integer %d or %i - 64-bit integer
%u - 64 bit unsigned integer %u - 64 bit unsigned integer
@ -202,7 +201,7 @@ static LONGHELP_BODY: &'static str = "
%o - 64 bit unsigned integer printed in octal (base 8) %o - 64 bit unsigned integer printed in octal (base 8)
FLOATING POINT SUBSTITUTIONS FLOATING POINT SUBSTITUTIONS
All floating point fields have a 'max decimal places / max significant digits' parameter All floating point fields have a 'max decimal places / max significant digits' parameter
%.10f means a decimal floating point with 7 decimal places past 0 %.10f means a decimal floating point with 7 decimal places past 0
@ -212,7 +211,7 @@ static LONGHELP_BODY: &'static str = "
Like with GNU coreutils, the value after the decimal point is these outputs is parsed as a double first before being rendered to text. For both implementations do not expect meaningful precision past the 18th decimal place. When using a number of decimal places that is 18 or higher, you can expect variation in output between GNU coreutils printf and this printf at the 18th decimal place of +/- 1 Like with GNU coreutils, the value after the decimal point is these outputs is parsed as a double first before being rendered to text. For both implementations do not expect meaningful precision past the 18th decimal place. When using a number of decimal places that is 18 or higher, you can expect variation in output between GNU coreutils printf and this printf at the 18th decimal place of +/- 1
%f - floating point value presented in decimal, truncated and displayed to 6 decimal places by default. %f - floating point value presented in decimal, truncated and displayed to 6 decimal places by default.
There is not past-double behavior parity with Coreutils printf, values are not estimated or adjusted beyond input values. There is not past-double behavior parity with Coreutils printf, values are not estimated or adjusted beyond input values.
%e or %E - floating point value presented in scientific notation %e or %E - floating point value presented in scientific notation
7 significant digits by default 7 significant digits by default
@ -225,9 +224,9 @@ static LONGHELP_BODY: &'static str = "
Sci Note has 6 significant digits by default Sci Note has 6 significant digits by default
Trailing zeroes are removed Trailing zeroes are removed
Instead of being truncated, digit after last is rounded Instead of being truncated, digit after last is rounded
Like other behavior in this utility, the design choices of floating point Like other behavior in this utility, the design choices of floating point
behavior in this utility is selected to reproduce in exact behavior in this utility is selected to reproduce in exact
the behavior of GNU coreutils' printf from an inputs and outputs standpoint. the behavior of GNU coreutils' printf from an inputs and outputs standpoint.
USING PARAMETERS USING PARAMETERS
@ -239,8 +238,8 @@ static LONGHELP_BODY: &'static str = "
leading spaces leading spaces
The 2nd parameter is proceeded by a dot. The 2nd parameter is proceeded by a dot.
You do not have to use parameters You do not have to use parameters
SPECIAL FORMS OF INPUT SPECIAL FORMS OF INPUT
For numeric input, the following additional forms of input are accepted besides decimal: For numeric input, the following additional forms of input are accepted besides decimal:
Octal (only with integer): if the argument begins with a 0 the proceeding characters Octal (only with integer): if the argument begins with a 0 the proceeding characters
@ -255,13 +254,13 @@ static LONGHELP_BODY: &'static str = "
of the next character will be interpreted as an 8-bit unsigned integer. If there are of the next character will be interpreted as an 8-bit unsigned integer. If there are
additional bytes, they will throw an error (unless the environment variable POSIXLY_CORRECt is set) additional bytes, they will throw an error (unless the environment variable POSIXLY_CORRECt is set)
WRITTEN BY : WRITTEN BY :
Nathan E. Ross, et al. for the uutils project Nathan E. Ross, et al. for the uutils project
MORE INFO : MORE INFO :
https://github.com/uutils/coreutils https://github.com/uutils/coreutils
COPYRIGHT : COPYRIGHT :
Copyright 2015 uutils project. Copyright 2015 uutils project.
Licensed under the MIT License, please see LICENSE file for details Licensed under the MIT License, please see LICENSE file for details
@ -279,7 +278,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
if formatstr == "--help" { if formatstr == "--help" {
print!("{} {}", LONGHELP_LEAD, LONGHELP_BODY); print!("{} {}", LONGHELP_LEAD, LONGHELP_BODY);
} else if formatstr == "--version" { } else if formatstr == "--version" {
println!("{} {}", NAME, VERSION); println!("{} {}", NAME, VERSION);
} else { } else {
let printf_args = &args[2..]; let printf_args = &args[2..];
memo::Memo::run_all(formatstr, printf_args); memo::Memo::run_all(formatstr, printf_args);

View file

@ -8,12 +8,12 @@ name = "uu_ptx"
path = "ptx.rs" path = "ptx.rs"
[dependencies] [dependencies]
getopts = "0.2" getopts = "0.2.14"
libc = "0.2" libc = "0.2.26"
aho-corasick = "0.6" aho-corasick = "0.6.3"
memchr = "1.0" memchr = "1.0.1"
regex-syntax = "0.4" regex-syntax = "0.4.1"
regex = "0.2" regex = "0.2.2"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_pwd"
path = "pwd.rs" path = "pwd.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_readlink"
path = "readlink.rs" path = "readlink.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_realpath"
path = "realpath.rs" path = "realpath.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_relpath"
path = "relpath.rs" path = "relpath.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,9 @@ name = "uu_rm"
path = "rm.rs" path = "rm.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
walkdir = "1.0.7"
remove_dir_all = "0.2"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -10,6 +10,8 @@
*/ */
extern crate getopts; extern crate getopts;
extern crate remove_dir_all;
extern crate walkdir;
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
@ -18,7 +20,9 @@ use std::collections::VecDeque;
use std::fs; use std::fs;
use std::io::{stdin, stderr, BufRead, Write}; use std::io::{stdin, stderr, BufRead, Write};
use std::ops::BitOr; use std::ops::BitOr;
use std::path::{Path, PathBuf}; use std::path::Path;
use remove_dir_all::remove_dir_all;
use walkdir::{DirEntry, WalkDir};
#[derive(Eq, PartialEq, Clone, Copy)] #[derive(Eq, PartialEq, Clone, Copy)]
enum InteractiveMode { enum InteractiveMode {
@ -27,6 +31,17 @@ enum InteractiveMode {
InteractiveAlways InteractiveAlways
} }
struct Options {
force: bool,
interactive: InteractiveMode,
#[allow(dead_code)]
one_fs: bool,
preserve_root: bool,
recursive: bool,
dir: bool,
verbose: bool
}
static NAME: &'static str = "rm"; static NAME: &'static str = "rm";
static VERSION: &'static str = env!("CARGO_PKG_VERSION"); static VERSION: &'static str = env!("CARGO_PKG_VERSION");
@ -77,32 +92,36 @@ pub fn uumain(args: Vec<String>) -> i32 {
show_error!("for help, try '{0} --help'", NAME); show_error!("for help, try '{0} --help'", NAME);
return 1; return 1;
} else { } else {
let force = matches.opt_present("force"); let options = Options {
let interactive = force: matches.opt_present("force"),
if matches.opt_present("i") { interactive: {
InteractiveMode::InteractiveAlways if matches.opt_present("i") {
} else if matches.opt_present("I") { InteractiveMode::InteractiveAlways
InteractiveMode::InteractiveOnce } else if matches.opt_present("I") {
} else if matches.opt_present("interactive") { InteractiveMode::InteractiveOnce
match &matches.opt_str("interactive").unwrap()[..] { } else if matches.opt_present("interactive") {
"none" => InteractiveMode::InteractiveNone, match &matches.opt_str("interactive").unwrap()[..] {
"once" => InteractiveMode::InteractiveOnce, "none" => InteractiveMode::InteractiveNone,
"always" => InteractiveMode::InteractiveAlways, "once" => InteractiveMode::InteractiveOnce,
val => { "always" => InteractiveMode::InteractiveAlways,
crash!(1, "Invalid argument to interactive ({})", val) val => {
crash!(1, "Invalid argument to interactive ({})", val)
}
} }
} else {
InteractiveMode::InteractiveNone
} }
} else { },
InteractiveMode::InteractiveNone one_fs: matches.opt_present("one-file-system"),
}; preserve_root: !matches.opt_present("no-preserve-root"),
let one_fs = matches.opt_present("one-file-system"); recursive: matches.opt_present("recursive"),
let preserve_root = !matches.opt_present("no-preserve-root"); dir: matches.opt_present("dir"),
let recursive = matches.opt_present("recursive"); verbose: matches.opt_present("verbose")
let dir = matches.opt_present("dir"); };
let verbose = matches.opt_present("verbose"); if options.interactive == InteractiveMode::InteractiveOnce
if interactive == InteractiveMode::InteractiveOnce && (recursive || matches.free.len() > 3) { && (options.recursive || matches.free.len() > 3) {
let msg = let msg =
if recursive { if options.recursive {
"Remove all arguments recursively? " "Remove all arguments recursively? "
} else { } else {
"Remove all arguments? " "Remove all arguments? "
@ -112,7 +131,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
} }
} }
if remove(matches.free, force, interactive, one_fs, preserve_root, recursive, dir, verbose) { if remove(matches.free, options) {
return 1; return 1;
} }
} }
@ -120,118 +139,100 @@ pub fn uumain(args: Vec<String>) -> i32 {
0 0
} }
// TODO: implement one-file-system // TODO: implement one-file-system (this may get partially implemented in walkdir)
#[allow(unused_variables)] fn remove(files: Vec<String>, options: Options) -> bool {
fn remove(files: Vec<String>, force: bool, interactive: InteractiveMode, one_fs: bool, preserve_root: bool, recursive: bool, dir: bool, verbose: bool) -> bool {
let mut had_err = false; let mut had_err = false;
for filename in &files { for filename in &files {
let filename = &filename[..];
let file = Path::new(filename); let file = Path::new(filename);
match file.symlink_metadata() { had_err = match file.symlink_metadata() {
Ok(metadata) => if metadata.is_dir() { Ok(metadata) => {
if recursive && (filename != "/" || !preserve_root) { if metadata.is_dir() {
if interactive != InteractiveMode::InteractiveAlways { handle_dir(file, &options)
if let Err(e) = fs::remove_dir_all(file) {
had_err = true;
show_error!("could not remove '{}': {}", filename, e);
};
} else {
let mut dirs: VecDeque<PathBuf> = VecDeque::new();
let mut files: Vec<PathBuf> = Vec::new();
let mut rmdirstack: Vec<PathBuf> = Vec::new();
dirs.push_back(file.to_path_buf());
while !dirs.is_empty() {
let dir = dirs.pop_front().unwrap();
if !prompt(&(format!("rm: descend into directory '{}'? ", dir.display()))[..]) {
continue;
}
// iterate over items in this directory, adding to either file or
// directory queue
match fs::read_dir(dir.as_path()) {
Ok(rdir) => {
for ent in rdir {
match ent {
Ok(ref f) => match f.file_type() {
Ok(t) => {
if t.is_dir() {
dirs.push_back(f.path());
} else {
files.push(f.path());
}
},
Err(e) => {
had_err = true;
show_error!("reading '{}': {}", f.path().display(), e);
},
},
Err(ref e) => {
had_err = true;
show_error!("recursing into '{}': {}", filename, e);
},
};
}
},
Err(e) => {
had_err = true;
show_error!("could not recurse into '{}': {}", dir.display(), e);
continue;
},
};
for f in &files {
had_err = remove_file(f.as_path(), interactive, verbose).bitor(had_err);
}
files.clear();
rmdirstack.push(dir);
}
for d in rmdirstack.iter().rev() {
had_err = remove_dir(d.as_path(), interactive, verbose).bitor(had_err);
}
}
} else if dir && (filename != "/" || !preserve_root) {
had_err = remove_dir(&file, interactive, verbose).bitor(had_err);
} else { } else {
if recursive { remove_file(file, &options)
show_error!("could not remove directory '{}'", filename);
had_err = true;
} else {
show_error!("could not remove directory '{}' (did you mean to pass '-r'?)", filename);
had_err = true;
}
} }
} else { }
had_err = remove_file(&file, interactive, verbose).bitor(had_err); Err(_e) => {
}, // TODO: actually print out the specific error
Err(e) => {
// TODO: When the error is not about missing files // TODO: When the error is not about missing files
// (e.g., permission), even rm -f should fail with // (e.g., permission), even rm -f should fail with
// outputting the error, but there's no easy eay. // outputting the error, but there's no easy eay.
if !force { if !options.force {
had_err = true;
show_error!("no such file or directory '{}'", filename); show_error!("no such file or directory '{}'", filename);
true
} else {
false
} }
} }
}.bitor(had_err);
}
had_err
}
fn handle_dir(path: &Path, options: &Options) -> bool {
let mut had_err = false;
let is_root = path.has_root() && path.parent().is_none();
if options.recursive && (!is_root || !options.preserve_root) {
if options.interactive != InteractiveMode::InteractiveAlways {
// we need the extra crate because apparently fs::remove_dir_all() does not function
// correctly on Windows
if let Err(e) = remove_dir_all(path) {
had_err = true;
show_error!("could not remove '{}': {}", path.display(), e);
}
} else {
let mut dirs: VecDeque<DirEntry> = VecDeque::new();
for entry in WalkDir::new(path) {
match entry {
Ok(entry) => {
let file_type = entry.file_type();
if file_type.is_dir() {
dirs.push_back(entry);
} else {
had_err = remove_file(entry.path(), options).bitor(had_err);
}
}
Err(e) => {
had_err = true;
show_error!("recursing in '{}': {}", path.display(), e);
}
}
}
for dir in dirs.iter().rev() {
had_err = remove_dir(dir.path(), options).bitor(had_err);
}
}
} else if options.dir && (!is_root || !options.preserve_root) {
had_err = remove_dir(path, options).bitor(had_err);
} else {
if options.recursive {
show_error!("could not remove directory '{}'", path.display());
had_err = true;
} else {
show_error!("could not remove directory '{}' (did you mean to pass '-r'?)",
path.display());
had_err = true;
} }
} }
had_err had_err
} }
fn remove_dir(path: &Path, interactive: InteractiveMode, verbose: bool) -> bool { fn remove_dir(path: &Path, options: &Options) -> bool {
let response = let response =
if interactive == InteractiveMode::InteractiveAlways { if options.interactive == InteractiveMode::InteractiveAlways {
prompt_file(path, true) prompt_file(path, true)
} else { } else {
true true
}; };
if response { if response {
match fs::remove_dir(path) { match fs::remove_dir(path) {
Ok(_) => if verbose { println!("removed '{}'", path.display()); }, Ok(_) => if options.verbose { println!("removed '{}'", path.display()); },
Err(e) => { Err(e) => {
show_error!("removing '{}': {}", path.display(), e); show_error!("removing '{}': {}", path.display(), e);
return true; return true;
@ -242,16 +243,16 @@ fn remove_dir(path: &Path, interactive: InteractiveMode, verbose: bool) -> bool
false false
} }
fn remove_file(path: &Path, interactive: InteractiveMode, verbose: bool) -> bool { fn remove_file(path: &Path, options: &Options) -> bool {
let response = let response =
if interactive == InteractiveMode::InteractiveAlways { if options.interactive == InteractiveMode::InteractiveAlways {
prompt_file(path, false) prompt_file(path, false)
} else { } else {
true true
}; };
if response { if response {
match fs::remove_file(path) { match fs::remove_file(path) {
Ok(_) => if verbose { println!("removed '{}'", path.display()); }, Ok(_) => if options.verbose { println!("removed '{}'", path.display()); },
Err(e) => { Err(e) => {
show_error!("removing '{}': {}", path.display(), e); show_error!("removing '{}': {}", path.display(), e);
return true; return true;
@ -264,22 +265,24 @@ fn remove_file(path: &Path, interactive: InteractiveMode, verbose: bool) -> bool
fn prompt_file(path: &Path, is_dir: bool) -> bool { fn prompt_file(path: &Path, is_dir: bool) -> bool {
if is_dir { if is_dir {
prompt(&(format!("rm: remove directory '{}'? ", path.display()))[..]) prompt(&(format!("rm: remove directory '{}'? ", path.display())))
} else { } else {
prompt(&(format!("rm: remove file '{}'? ", path.display()))[..]) prompt(&(format!("rm: remove file '{}'? ", path.display())))
} }
} }
fn prompt(msg: &str) -> bool { fn prompt(msg: &str) -> bool {
stderr().write_all(msg.as_bytes()).unwrap_or(()); let _ = stderr().write_all(msg.as_bytes());
stderr().flush().unwrap_or(()); let _ = stderr().flush();
let mut buf = Vec::new(); let mut buf = Vec::new();
let stdin = stdin(); let stdin = stdin();
let mut stdin = stdin.lock(); let mut stdin = stdin.lock();
match stdin.read_until('\n' as u8, &mut buf) { match stdin.read_until('\n' as u8, &mut buf) {
Ok(x) if x > 0 => { Ok(x) if x > 0 => {
match buf[0] { match buf[0] {
0x59 | 0x79 => true, b'y' | b'Y' => true,
_ => false, _ => false,
} }
} }

View file

@ -8,7 +8,7 @@ name = "uu_rmdir"
path = "rmdir.rs" path = "rmdir.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_seq"
path = "seq.rs" path = "seq.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -9,10 +9,10 @@ path = "shred.rs"
[dependencies] [dependencies]
rand = "0.3" rand = "0.3"
filetime = "*" filetime = "0.1.10"
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
time = "*" time = "0.1.38"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_shuf"
path = "shuf.rs" path = "shuf.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
rand = "*" rand = "0.3.15"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_sleep"
path = "sleep.rs" path = "sleep.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,9 +8,9 @@ name = "uu_sort"
path = "sort.rs" path = "sort.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
semver = "*" semver = "0.7.0"
itertools = "*" itertools = "0.6.0"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -16,7 +16,6 @@ extern crate semver;
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
#[macro_use]
extern crate itertools; extern crate itertools;
use std::cmp::Ordering; use std::cmp::Ordering;

View file

@ -8,7 +8,7 @@ name = "uu_split"
path = "split.rs" path = "split.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_stat"
path = "stat.rs" path = "stat.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
time = "*" time = "0.1.38"
[dependencies.uucore] [dependencies.uucore]
path = "../uucore" path = "../uucore"

View file

@ -8,7 +8,7 @@ name = "uu_stdbuf"
path = "stdbuf.rs" path = "stdbuf.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_sum"
path = "sum.rs" path = "sum.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,10 +8,10 @@ name = "uu_sync"
path = "sync.rs" path = "sync.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
winapi = "*" winapi = "0.2.8"
kernel32-sys = "*" kernel32-sys = "0.2.2"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -14,9 +14,13 @@
extern crate getopts; extern crate getopts;
extern crate libc; extern crate libc;
#[cfg(windows)]
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
#[cfg(not(windows))]
extern crate uucore;
static NAME: &'static str = "sync"; static NAME: &'static str = "sync";
static VERSION: &'static str = env!("CARGO_PKG_VERSION"); static VERSION: &'static str = env!("CARGO_PKG_VERSION");

View file

@ -8,7 +8,7 @@ name = "uu_tac"
path = "tac.rs" path = "tac.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,10 +8,10 @@ name = "uu_tail"
path = "tail.rs" path = "tail.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
kernel32-sys = "*" kernel32-sys = "0.2.2"
libc = "*" libc = "0.2.26"
winapi = "*" winapi = "0.2.8"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_tee"
path = "tee.rs" path = "tee.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_test"
path = "test.rs" path = "test.rs"
[dependencies] [dependencies]
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,9 +8,9 @@ name = "uu_timeout"
path = "timeout.rs" path = "timeout.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
time = "*" time = "0.1.38"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,9 +8,9 @@ name = "uu_touch"
path = "touch.rs" path = "touch.rs"
[dependencies] [dependencies]
filetime = "*" filetime = "0.1.10"
getopts = "*" getopts = "0.2.14"
time = "*" time = "0.1.38"
[dependencies.uucore] [dependencies.uucore]
path = "../uucore" path = "../uucore"

View file

@ -8,9 +8,9 @@ name = "uu_tr"
path = "tr.rs" path = "tr.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
bit-set = "*" bit-set = "0.4.0"
fnv = "*" fnv = "1.0.5"
[dependencies.uucore] [dependencies.uucore]
path = "../uucore" path = "../uucore"

View file

@ -32,66 +32,131 @@ static NAME: &'static str = "tr";
static VERSION: &'static str = env!("CARGO_PKG_VERSION"); static VERSION: &'static str = env!("CARGO_PKG_VERSION");
const BUFFER_LEN: usize = 1024; const BUFFER_LEN: usize = 1024;
fn delete(set: ExpandSet, complement: bool) { trait SymbolTranslator {
let mut bset = BitSet::new(); fn translate(&self, c: &char, prev_c: &char) -> Option<char>;
let stdin = stdin(); }
let mut locked_stdin = stdin.lock();
let mut buffered_stdout = BufWriter::new(stdout());
let mut buf = String::with_capacity(BUFFER_LEN + 4);
let mut char_output_buffer: [u8; 4] = [0;4];
for c in set { struct DeleteOperation {
bset.insert(c as usize); bset: BitSet,
} complement: bool,
}
let is_allowed = |c : char| { impl DeleteOperation {
if complement { fn new(set: ExpandSet, complement: bool) -> DeleteOperation {
bset.contains(c as usize) DeleteOperation {
} else { bset: set.map(|c| c as usize).collect(),
!bset.contains(c as usize) complement: complement
} }
};
while let Ok(length) = locked_stdin.read_line(&mut buf) {
if length == 0 { break }
{ // isolation to make borrow checker happy
let filtered = buf.chars().filter(|c| is_allowed(*c));
for c in filtered {
let char_as_bytes = c.encode_utf8(&mut char_output_buffer);
buffered_stdout.write_all(char_as_bytes.as_bytes()).unwrap();
}
}
buf.clear();
} }
} }
fn tr<'a>(set1: ExpandSet<'a>, mut set2: ExpandSet<'a>) { impl SymbolTranslator for DeleteOperation {
let mut map = FnvHashMap::default(); fn translate(&self, c: &char, _prev_c: &char) -> Option<char> {
let stdin = stdin(); let uc = *c as usize;
let mut locked_stdin = stdin.lock(); if self.complement == self.bset.contains(uc) {
let mut buffered_stdout = BufWriter::new(stdout()); Some(*c)
let mut buf = String::with_capacity(BUFFER_LEN + 4); } else {
let mut char_output_buffer: [u8; 4] = [0;4]; None
let mut s2_prev = '_';
for i in set1 {
s2_prev = set2.next().unwrap_or(s2_prev);
map.insert(i as usize, s2_prev);
}
while let Ok(length) = locked_stdin.read_line(&mut buf) {
if length == 0 { break }
{ // isolation to make borrow checker happy
let output_stream = buf.chars().map(|c| *map.get(&(c as usize)).unwrap_or(&c));
for c in output_stream {
let char_as_bytes = c.encode_utf8(&mut char_output_buffer);
buffered_stdout.write_all(char_as_bytes.as_bytes()).unwrap();
}
} }
}
}
struct SqueezeOperation {
squeeze_set: BitSet,
complement: bool,
}
impl SqueezeOperation {
fn new(squeeze_set: ExpandSet, complement: bool) -> SqueezeOperation {
SqueezeOperation {
squeeze_set: squeeze_set.map(|c| c as usize).collect(),
complement: complement
}
}
}
impl SymbolTranslator for SqueezeOperation {
fn translate(&self, c: &char, prev_c: &char) -> Option<char> {
if *prev_c == *c && self.complement != self.squeeze_set.contains(*c as usize) {
None
} else {
Some(*c)
}
}
}
struct DeleteAndSqueezeOperation {
delete_set: BitSet,
squeeze_set: BitSet,
complement: bool,
}
impl DeleteAndSqueezeOperation {
fn new(delete_set: ExpandSet, squeeze_set: ExpandSet, complement: bool) -> DeleteAndSqueezeOperation {
DeleteAndSqueezeOperation {
delete_set: delete_set.map(|c| c as usize).collect(),
squeeze_set: squeeze_set.map(|c| c as usize).collect(),
complement: complement
}
}
}
impl SymbolTranslator for DeleteAndSqueezeOperation {
fn translate(&self, c: &char, prev_c: &char) -> Option<char> {
if self.complement != self.delete_set.contains(*c as usize) || *prev_c == *c && self.squeeze_set.contains(*c as usize) {
None
} else {
Some(*c)
}
}
}
struct TranslateOperation {
translate_map: FnvHashMap<usize, char>,
}
impl TranslateOperation {
fn new(set1: ExpandSet, set2: &mut ExpandSet) -> TranslateOperation {
let mut map = FnvHashMap::default();
let mut s2_prev = '_';
for i in set1 {
s2_prev = set2.next().unwrap_or(s2_prev);
map.insert(i as usize, s2_prev);
}
TranslateOperation {
translate_map: map,
}
}
}
impl SymbolTranslator for TranslateOperation {
fn translate(&self, c: &char, _prev_c: &char) -> Option<char> {
Some(*self.translate_map.get(&(*c as usize)).unwrap_or(c))
}
}
fn translate_input<T: SymbolTranslator>(input: &mut BufRead, output: &mut Write, translator: T) {
let mut buf = String::with_capacity(BUFFER_LEN + 4);
let mut output_buf = String::with_capacity(BUFFER_LEN + 4);
while let Ok(length) = input.read_line(&mut buf) {
let mut prev_c = 0 as char;
if length == 0 { break }
{ // isolation to make borrow checker happy
let filtered = buf.chars().filter_map(|c| {
let res = translator.translate(&c, &prev_c);
if res.is_some() {
prev_c = c;
}
res
});
output_buf.extend(filtered);
output.write_all(output_buf.as_bytes()).unwrap();
}
buf.clear(); buf.clear();
output_buf.clear();
} }
} }
@ -111,6 +176,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
opts.optflag("C", "", "same as -c"); opts.optflag("C", "", "same as -c");
opts.optflag("d", "delete", "delete characters in SET1"); opts.optflag("d", "delete", "delete characters in SET1");
opts.optflag("h", "help", "display this help and exit"); opts.optflag("h", "help", "display this help and exit");
opts.optflag("s", "squeeze", "replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character");
opts.optflag("V", "version", "output version information and exit"); opts.optflag("V", "version", "output version information and exit");
let matches = match opts.parse(&args[1..]) { let matches = match opts.parse(&args[1..]) {
@ -138,20 +204,37 @@ pub fn uumain(args: Vec<String>) -> i32 {
let dflag = matches.opt_present("d"); let dflag = matches.opt_present("d");
let cflag = matches.opts_present(&["c".to_owned(), "C".to_owned()]); let cflag = matches.opts_present(&["c".to_owned(), "C".to_owned()]);
let sflag = matches.opt_present("s");
let sets = matches.free; let sets = matches.free;
if cflag && !dflag { if cflag && !dflag && !sflag {
show_error!("-c is only supported with -d"); show_error!("-c is only supported with -d or -s");
return 1; return 1;
} }
let stdin = stdin();
let mut locked_stdin = stdin.lock();
let stdout = stdout();
let locked_stdout = stdout.lock();
let mut buffered_stdout = BufWriter::new(locked_stdout);
let set1 = ExpandSet::new(sets[0].as_ref());
if dflag { if dflag {
let set1 = ExpandSet::new(sets[0].as_ref()); if sflag {
delete(set1, cflag); let set2 = ExpandSet::new(sets[1].as_ref());
let op = DeleteAndSqueezeOperation::new(set1, set2, cflag);
translate_input(&mut locked_stdin, &mut buffered_stdout, op);
} else {
let op = DeleteOperation::new(set1, cflag);
translate_input(&mut locked_stdin, &mut buffered_stdout, op);
}
} else if sflag {
let op = SqueezeOperation::new(set1, cflag);
translate_input(&mut locked_stdin, &mut buffered_stdout, op);
} else { } else {
let set1 = ExpandSet::new(sets[0].as_ref()); let mut set2 = ExpandSet::new(sets[1].as_ref());
let set2 = ExpandSet::new(sets[1].as_ref()); let op = TranslateOperation::new(set1, &mut set2);
tr(set1, set2); translate_input(&mut locked_stdin, &mut buffered_stdout, op)
} }
0 0

View file

@ -8,7 +8,7 @@ name = "uu_truncate"
path = "truncate.rs" path = "truncate.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_tsort"
path = "tsort.rs" path = "tsort.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_tty"
path = "tty.rs" path = "tty.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,8 +8,8 @@ name = "uu_unexpand"
path = "unexpand.rs" path = "unexpand.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
unicode-width = "*" unicode-width = "0.1.4"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_uniq"
path = "uniq.rs" path = "uniq.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
[dependencies.uucore] [dependencies.uucore]
path="../uucore" path="../uucore"

View file

@ -8,8 +8,8 @@ name = "uu_unlink"
path = "unlink.rs" path = "unlink.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
libc = "*" libc = "0.2.26"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -8,7 +8,7 @@ name = "uu_uptime"
path = "uptime.rs" path = "uptime.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
[dependencies.uucore] [dependencies.uucore]
path = "../uucore" path = "../uucore"

View file

@ -8,7 +8,7 @@ name = "uu_users"
path = "users.rs" path = "users.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
[dependencies.uucore] [dependencies.uucore]
default-features = false default-features = false

View file

@ -16,9 +16,8 @@
#![allow(dead_code)] #![allow(dead_code)]
extern crate getopts; extern crate getopts;
#[macro_use]
extern crate uucore; extern crate uucore;
use uucore::utmpx::*; use uucore::utmpx::*;
use getopts::Options; use getopts::Options;

View file

@ -4,8 +4,8 @@ version = "0.0.1"
authors = [] authors = []
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
time = { version = "*", optional = true } time = { version = "0.1.38", optional = true }
data-encoding = { version = "^1.1", optional = true } data-encoding = { version = "^1.1", optional = true }
[dependencies.libc] [dependencies.libc]

View file

@ -8,7 +8,7 @@ name = "uu_wc"
path = "wc.rs" path = "wc.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

View file

@ -13,7 +13,7 @@ default-features = false
features = ["utmpx"] features = ["utmpx"]
[dependencies.clippy] [dependencies.clippy]
version = "*" version = "0.0.143"
optional = true optional = true
[[bin]] [[bin]]

View file

@ -8,9 +8,9 @@ name = "uu_whoami"
path = "whoami.rs" path = "whoami.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
winapi = "*" winapi = "0.2.8"
advapi32-sys = "*" advapi32-sys = "0.2.0"
[dependencies.uucore] [dependencies.uucore]
path = "../uucore" path = "../uucore"

View file

@ -8,7 +8,7 @@ name = "uu_yes"
path = "yes.rs" path = "yes.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "0.2.14"
uucore = { path="../uucore" } uucore = { path="../uucore" }
[[bin]] [[bin]]

1
tests/fixtures/cp/existing_file.txt vendored Normal file
View file

@ -0,0 +1 @@
Cogito ergo sum.

1
tests/fixtures/cp/how_are_you.txt vendored Normal file
View file

@ -0,0 +1 @@
How are you?

View file

@ -1,10 +1,17 @@
use common::util::*; use common::util::*;
use std::fs::set_permissions;
static TEST_HELLO_WORLD_SOURCE: &'static str = "hello_world.txt"; static TEST_EXISTING_FILE: &str = "existing_file.txt";
static TEST_HELLO_WORLD_DEST: &'static str = "copy_of_hello_world.txt"; static TEST_HELLO_WORLD_SOURCE: &str = "hello_world.txt";
static TEST_COPY_TO_FOLDER: &'static str = "hello_dir/"; static TEST_HELLO_WORLD_DEST: &str = "copy_of_hello_world.txt";
static TEST_COPY_TO_FOLDER_FILE: &'static str = "hello_dir/hello_world.txt"; static TEST_HOW_ARE_YOU_SOURCE: &str = "how_are_you.txt";
static TEST_COPY_FROM_FOLDER_FILE: &'static str = "hello_dir_with_file/hello_world.txt"; static TEST_HOW_ARE_YOU_DEST: &str = "hello_dir/how_are_you.txt";
static TEST_COPY_TO_FOLDER: &str = "hello_dir/";
static TEST_COPY_TO_FOLDER_FILE: &str = "hello_dir/hello_world.txt";
static TEST_COPY_FROM_FOLDER: &str = "hello_dir_with_file/";
static TEST_COPY_FROM_FOLDER_FILE: &str = "hello_dir_with_file/hello_world.txt";
static TEST_COPY_TO_FOLDER_NEW: &str = "hello_dir_new/";
static TEST_COPY_TO_FOLDER_NEW_FILE: &str = "hello_dir_new/hello_world.txt";
#[test] #[test]
fn test_cp_cp() { fn test_cp_cp() {
@ -22,6 +29,73 @@ fn test_cp_cp() {
assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n");
} }
#[test]
fn test_cp_duplicate_files() {
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_COPY_TO_FOLDER)
.run();
assert!(result.success);
assert!(result.stderr.contains("specified more than once"));
assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n");
}
#[test]
fn test_cp_multiple_files_target_is_file() {
let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_EXISTING_FILE)
.run();
assert!(!result.success);
assert!(result.stderr.contains("not a directory"));
}
#[test]
fn test_cp_directory_not_recursive() {
let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_COPY_TO_FOLDER)
.arg(TEST_HELLO_WORLD_DEST)
.run();
assert!(!result.success);
assert!(result.stderr.contains("omitting directory"));
}
#[test]
fn test_cp_multiple_files() {
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HOW_ARE_YOU_SOURCE)
.arg(TEST_COPY_TO_FOLDER)
.run();
assert!(result.success);
assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n");
assert_eq!(at.read(TEST_HOW_ARE_YOU_DEST), "How are you?\n");
}
#[test]
fn test_cp_recurse() {
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd
.arg("-r")
.arg(TEST_COPY_FROM_FOLDER)
.arg(TEST_COPY_TO_FOLDER_NEW)
.run();
assert!(result.success);
// Check the content of the destination file that was copied.
assert_eq!(at.read(TEST_COPY_TO_FOLDER_NEW_FILE), "Hello, World!\n");
}
#[test] #[test]
fn test_cp_with_dirs_t() { fn test_cp_with_dirs_t() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
@ -56,3 +130,156 @@ fn test_cp_with_dirs() {
assert!(result_from_dir.success); assert!(result_from_dir.success);
assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n"); assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n");
} }
#[test]
fn test_cp_arg_target_directory() {
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("-t")
.arg(TEST_COPY_TO_FOLDER)
.run();
assert!(result.success);
assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n");
}
#[test]
fn test_cp_arg_no_target_directory() {
let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("-v")
.arg("-T")
.arg(TEST_COPY_TO_FOLDER)
.run();
assert!(!result.success);
assert!(result.stderr.contains("cannot overwrite directory"));
}
#[test]
fn test_cp_arg_interactive() {
let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HOW_ARE_YOU_SOURCE)
.arg("-i")
.pipe_in("N\n")
.run();
assert!(result.success);
assert!(result.stderr.contains("Not overwriting"));
}
#[test]
#[cfg(target_os="unix")]
fn test_cp_arg_link() {
use std::os::linux::fs::MetadataExt;
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("--link")
.arg(TEST_HELLO_WORLD_DEST)
.run();
assert!(result.success);
assert_eq!(at.metadata(TEST_HELLO_WORLD_SOURCE).st_nlink(), 2);
}
#[test]
fn test_cp_arg_symlink() {
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("--symbolic-link")
.arg(TEST_HELLO_WORLD_DEST)
.run();
assert!(result.success);
assert!(at.is_symlink(TEST_HELLO_WORLD_DEST));
}
#[test]
fn test_cp_arg_no_clobber() {
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("--no-clobber")
.arg(TEST_HOW_ARE_YOU_SOURCE)
.run();
assert!(result.success);
assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "How are you?\n");
assert!(result.stderr.contains("Not overwriting"));
}
#[test]
#[cfg(not(windows))]
fn test_cp_arg_force() {
let (at, mut ucmd) = at_and_ucmd!();
// create dest without write permissions
let mut permissions = at.make_file(TEST_HELLO_WORLD_DEST).metadata().unwrap().permissions();
permissions.set_readonly(true);
set_permissions(at.plus(TEST_HELLO_WORLD_DEST), permissions).unwrap();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("--force")
.arg(TEST_HELLO_WORLD_DEST)
.run();
println!("{:?}", result.stderr);
println!("{:?}", result.stdout);
assert!(result.success);
assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n");
}
/// TODO: write a better test that differentiates --remove-destination
/// from --force. Also this test currently doesn't work on
/// Windows. This test originally checked file timestamps, which
/// proved to be unreliable per target / CI platform
#[test]
#[cfg(not(windows))]
fn test_cp_arg_remove_destination() {
let (at, mut ucmd) = at_and_ucmd!();
// create dest without write permissions
let mut permissions = at.make_file(TEST_HELLO_WORLD_DEST).metadata().unwrap().permissions();
permissions.set_readonly(true);
set_permissions(at.plus(TEST_HELLO_WORLD_DEST), permissions).unwrap();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("--remove-destination")
.arg(TEST_HELLO_WORLD_DEST)
.run();
assert!(result.success);
assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n");
}
#[test]
fn test_cp_arg_backup() {
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("--backup")
.arg(TEST_HOW_ARE_YOU_SOURCE)
.run();
assert!(result.success);
assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n");
assert_eq!(at.read(&*format!("{}~", TEST_HOW_ARE_YOU_SOURCE)), "How are you?\n");
}
#[test]
fn test_cp_arg_suffix() {
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg("--suffix")
.arg(".bak")
.arg(TEST_HOW_ARE_YOU_SOURCE)
.run();
assert!(result.success);
assert_eq!(at.read(TEST_HOW_ARE_YOU_SOURCE), "Hello, World!\n");
assert_eq!(at.read(&*format!("{}.bak", TEST_HOW_ARE_YOU_SOURCE)), "How are you?\n");
}

View file

@ -32,3 +32,28 @@ fn test_delete_complement() {
new_ucmd!() new_ucmd!()
.args(&["-d", "-c", "a-z"]).pipe_in("aBcD").run().stdout_is("ac"); .args(&["-d", "-c", "a-z"]).pipe_in("aBcD").run().stdout_is("ac");
} }
#[test]
fn test_squeeze() {
new_ucmd!()
.args(&["-s", "a-z"]).pipe_in("aaBBcDcc").run().stdout_is("aBBcDc");
}
#[test]
fn test_squeeze_complement() {
new_ucmd!()
.args(&["-sc", "a-z"]).pipe_in("aaBBcDcc").run().stdout_is("aaBcDcc");
}
#[test]
fn test_delete_and_squeeze() {
new_ucmd!()
.args(&["-ds", "a-z", "A-Z"]).pipe_in("abBcB").run().stdout_is("B");
}
#[test]
fn test_delete_and_squeeze_complement() {
new_ucmd!()
.args(&["-dsc", "a-z", "A-Z"]).pipe_in("abBcB").run().stdout_is("abc");
}