mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
du: exit with status 1 on invalid arguments
This commit is contained in:
parent
69b5429e6a
commit
52c8e8daba
1 changed files with 7 additions and 6 deletions
13
du/du.rs
13
du/du.rs
|
@ -200,11 +200,11 @@ ers of 1000).",
|
|||
match (max_depth_str, max_depth) {
|
||||
(Some(ref s), _) if summarize => {
|
||||
println!("{}: warning: summarizing conflicts with --max-depth={:s}", program, *s);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
(Some(ref s), None) => {
|
||||
println!("{}: invalid maximum depth '{:s}'", program, *s);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
(Some(_), Some(_)) | (None, _) => { /* valid */ }
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ ers of 1000).",
|
|||
for c in s.as_slice().chars() {
|
||||
if found_letter && c.is_digit() || !found_number && !c.is_digit() {
|
||||
println!("{}: invalid --block-size argument '{}'", program, s);
|
||||
return 0;
|
||||
return 1;
|
||||
} else if c.is_digit() {
|
||||
found_number = true;
|
||||
numbers.push(c as u8);
|
||||
|
@ -261,7 +261,8 @@ ers of 1000).",
|
|||
"ZB" => 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000,
|
||||
"YB" => 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000,
|
||||
_ => {
|
||||
println!("{}: invalid --block-size argument '{}'", program, s); return 0;
|
||||
println!("{}: invalid --block-size argument '{}'", program, s);
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
number * multiple
|
||||
|
@ -300,7 +301,7 @@ Valid arguments are:
|
|||
- 'long-iso'
|
||||
- 'iso'
|
||||
Try '{program} --help' for more information.", s, program = program);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -339,7 +340,7 @@ Try '{program} --help' for more information.", s, program = program);
|
|||
Valid arguments are:
|
||||
- 'accessed', 'created', 'modified'
|
||||
Try '{program} --help' for more information.", program = program);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
},
|
||||
None => stat.fstat.modified
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue