mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Fix #784
This commit is contained in:
parent
d56c29acfe
commit
96817dfbc5
2 changed files with 17 additions and 3 deletions
13
Cargo.lock
generated
13
Cargo.lock
generated
|
@ -58,6 +58,7 @@ dependencies = [
|
||||||
"rm 0.0.1",
|
"rm 0.0.1",
|
||||||
"rmdir 0.0.1",
|
"rmdir 0.0.1",
|
||||||
"seq 0.0.1",
|
"seq 0.0.1",
|
||||||
|
"shred 0.0.1",
|
||||||
"shuf 0.0.1",
|
"shuf 0.0.1",
|
||||||
"sleep 0.0.1",
|
"sleep 0.0.1",
|
||||||
"sort 0.0.1",
|
"sort 0.0.1",
|
||||||
|
@ -720,6 +721,18 @@ dependencies = [
|
||||||
"uucore 0.0.1",
|
"uucore 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shred"
|
||||||
|
version = "0.0.1"
|
||||||
|
dependencies = [
|
||||||
|
"filetime 0.1.9 (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.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"uucore 0.0.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shuf"
|
name = "shuf"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
|
@ -211,7 +211,7 @@ fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
// TODO: make the regex processing occur earlier (i.e. once in the main function)
|
// TODO: make the regex processing occur earlier (i.e. once in the main function)
|
||||||
let re: regex::Regex = Regex::new(r"^(([ugoa]*)((?:[-+=](?:[rwxXst]*|[ugo]))+))|([-+=]?[0-7]+)$").unwrap();
|
let re: regex::Regex = Regex::new(r"^(([ugoa]*)((?:[-+=](?:[ugo]|[rwxXst]*))+))|([-+=]?[0-7]+)$").unwrap();
|
||||||
let mut stat: libc::stat = unsafe { mem::uninitialized() };
|
let mut stat: libc::stat = unsafe { mem::uninitialized() };
|
||||||
let statres = unsafe { libc::stat(path.as_ptr(), &mut stat as *mut libc::stat) };
|
let statres = unsafe { libc::stat(path.as_ptr(), &mut stat as *mut libc::stat) };
|
||||||
let mut fperm =
|
let mut fperm =
|
||||||
|
@ -233,11 +233,12 @@ fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool
|
||||||
levels = "a";
|
levels = "a";
|
||||||
}
|
}
|
||||||
let change = cap.at(3).unwrap().to_string() + "+";
|
let change = cap.at(3).unwrap().to_string() + "+";
|
||||||
let mut action = change.chars().next().unwrap();
|
let mut change = change.chars();
|
||||||
|
let mut action = change.next().unwrap();
|
||||||
let mut rwx = 0;
|
let mut rwx = 0;
|
||||||
let mut special = 0;
|
let mut special = 0;
|
||||||
let mut special_changed = false;
|
let mut special_changed = false;
|
||||||
for ch in change[1..].chars() {
|
for ch in change {
|
||||||
match ch {
|
match ch {
|
||||||
'+' | '-' | '=' => {
|
'+' | '-' | '=' => {
|
||||||
for level in levels.chars() {
|
for level in levels.chars() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue