mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
factor: fix uumain
This commit is contained in:
parent
39c8d36b5e
commit
2c4c2e4bb6
1 changed files with 5 additions and 5 deletions
|
@ -64,11 +64,10 @@ fn print_factors_str(num_str: &str) {
|
||||||
print_factors(num);
|
print_factors(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn main() { uumain(os::args()); }
|
fn main() { os::set_exit_status(uumain(os::args())); }
|
||||||
|
|
||||||
pub fn uumain(args: Vec<String>) {
|
pub fn uumain(args: Vec<String>) -> int {
|
||||||
let program = args.get(0).as_slice();
|
let program = args.get(0).as_slice();
|
||||||
let opts = [
|
let opts = [
|
||||||
getopts::optflag("h", "help", "show this help message"),
|
getopts::optflag("h", "help", "show this help message"),
|
||||||
|
@ -89,11 +88,11 @@ pub fn uumain(args: Vec<String>) {
|
||||||
\n\
|
\n\
|
||||||
{usage}", program = program, version = VERSION, usage = getopts::usage("Print the prime factors of the given number(s). \
|
{usage}", program = program, version = VERSION, usage = getopts::usage("Print the prime factors of the given number(s). \
|
||||||
If none are specified, read from standard input.", opts));
|
If none are specified, read from standard input.", opts));
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
println!("{} {}", program, VERSION);
|
println!("{} {}", program, VERSION);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.free.is_empty() {
|
if matches.free.is_empty() {
|
||||||
|
@ -105,4 +104,5 @@ pub fn uumain(args: Vec<String>) {
|
||||||
print_factors_str(num_str.as_slice());
|
print_factors_str(num_str.as_slice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue