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:
parent
2c4c2e4bb6
commit
2aa76c4202
1 changed files with 7 additions and 5 deletions
12
tail/tail.rs
12
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<String>) {
|
||||
pub fn uumain(args: Vec<String>) -> int {
|
||||
let mut line_count = 10u;
|
||||
let mut sleep_sec = 1000u64;
|
||||
|
||||
|
@ -51,15 +51,15 @@ pub fn uumain(args: Vec<String>) {
|
|||
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<String>) {
|
|||
tail(&mut buffer, line_count, follow, sleep_sec);
|
||||
}
|
||||
}
|
||||
|
||||
0
|
||||
}
|
||||
|
||||
// It searches for an option in the form of -123123
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue