From 2c4c2e4bb6caa95e73ad5664a2cc5ad263dae280 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Tue, 17 Jun 2014 19:33:53 +0200 Subject: [PATCH] factor: fix uumain --- factor/factor.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/factor/factor.rs b/factor/factor.rs index 58389de9d..b4db32292 100644 --- a/factor/factor.rs +++ b/factor/factor.rs @@ -64,11 +64,10 @@ fn print_factors_str(num_str: &str) { print_factors(num); } - #[allow(dead_code)] -fn main() { uumain(os::args()); } +fn main() { os::set_exit_status(uumain(os::args())); } -pub fn uumain(args: Vec) { +pub fn uumain(args: Vec) -> int { let program = args.get(0).as_slice(); let opts = [ getopts::optflag("h", "help", "show this help message"), @@ -89,11 +88,11 @@ pub fn uumain(args: Vec) { \n\ {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)); - return; + return 1; } if matches.opt_present("version") { println!("{} {}", program, VERSION); - return; + return 0; } if matches.free.is_empty() { @@ -105,4 +104,5 @@ pub fn uumain(args: Vec) { print_factors_str(num_str.as_slice()); } } + 0 }