1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

tail: fix uumain

This commit is contained in:
Michael Gehring 2014-06-17 19:35:48 +02:00
parent 2c4c2e4bb6
commit 2aa76c4202

View file

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