diff --git a/tail/tail.rs b/tail/tail.rs index a2591c3c8..61132ed7e 100644 --- a/tail/tail.rs +++ b/tail/tail.rs @@ -25,9 +25,9 @@ use std::io::timer::sleep; static PROGRAM: &'static str = "tail"; #[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 mut line_count = 10u; let mut sleep_sec = 1000u64; @@ -51,15 +51,15 @@ pub fn uumain(args: Vec) { Ok (m) => { m } Err(_) => { println!("{:s}", usage(PROGRAM, possible_options)); - return + return 1; } }; if given_options.opt_present("h") { println!("{:s}", usage(PROGRAM, possible_options)); - return; + return 0; } - if given_options.opt_present("V") { version(); return } + if given_options.opt_present("V") { version(); return 0 } let follow = given_options.opt_present("f"); if follow { @@ -112,6 +112,8 @@ pub fn uumain(args: Vec) { tail(&mut buffer, line_count, follow, sleep_sec); } } + + 0 } // It searches for an option in the form of -123123