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

sum: handle multiple file args

This commit is contained in:
Michael Gehring 2014-06-18 12:36:12 +02:00
parent ee92573584
commit 156577ec40

View file

@ -111,13 +111,14 @@ pub fn uumain(args: Vec<String>) -> int {
let sysv = matches.opt_present("sysv"); let sysv = matches.opt_present("sysv");
let file = if matches.free.is_empty() { let files = if matches.free.is_empty() {
"-" Vec::from_elem(1, "-".to_string())
} else { } else {
matches.free.get(0).as_slice() matches.free
}; };
let reader = match open(file) { for file in files.iter() {
let reader = match open(file.as_slice()) {
Ok(f) => f, Ok(f) => f,
_ => crash!(1, "unable to open file") _ => crash!(1, "unable to open file")
}; };
@ -128,6 +129,7 @@ pub fn uumain(args: Vec<String>) -> int {
}; };
println!("{} {}", sum, blocks); println!("{} {}", sum, blocks);
}
0 0
} }