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

Merge pull request #296 from ebfe/exit_status

Partial exit status cleanup
This commit is contained in:
Arcterus 2014-06-23 00:53:35 -07:00
commit 5471d5dd4d
7 changed files with 11 additions and 7 deletions

View file

@ -62,13 +62,13 @@ pub fn uumain(args: Vec<String>) -> int {
if args.len() < 2 { if args.len() < 2 {
println!("{}: {}", program, "missing operand"); println!("{}: {}", program, "missing operand");
println!("Try '{} --help' for more information.", program); println!("Try '{} --help' for more information.", program);
return 0; return 1;
} }
// too many arguments // too many arguments
else if args.len() > 3 { else if args.len() > 3 {
println!("{}: extra operand '{}'", program, args.get(3)); println!("{}: extra operand '{}'", program, args.get(3));
println!("Try '{} --help' for more information.", program); println!("Try '{} --help' for more information.", program);
return 0; return 1;
} }
// //

View file

@ -66,6 +66,7 @@ directory).", opts).as_slice());
} else { } else {
println!("{0:s}: missing operand", program); println!("{0:s}: missing operand", program);
println!("Try '{0:s} --help' for more information.", program); println!("Try '{0:s} --help' for more information.", program);
return 1;
} }
0 0

4
env/env.rs vendored
View file

@ -114,7 +114,7 @@ pub fn uumain(args: Vec<String>) -> int {
_ => { _ => {
println!("{:s}: invalid option \"{:s}\"", prog, *opt); println!("{:s}: invalid option \"{:s}\"", prog, *opt);
println!("Type \"{:s} --help\" for detailed informations", prog); println!("Type \"{:s} --help\" for detailed informations", prog);
return 0; return 1;
} }
} }
} else if opt.as_slice().starts_with("-") { } else if opt.as_slice().starts_with("-") {
@ -146,7 +146,7 @@ pub fn uumain(args: Vec<String>) -> int {
_ => { _ => {
println!("{:s}: illegal option -- {:c}", prog, c); println!("{:s}: illegal option -- {:c}", prog, c);
println!("Type \"{:s} --help\" for detailed informations", prog); println!("Type \"{:s} --help\" for detailed informations", prog);
return 0; return 1;
} }
} }
} }

View file

@ -46,7 +46,7 @@ pub fn uumain(args: Vec<String>) -> int {
Ok (m) => { m } Ok (m) => { m }
Err(_) => { Err(_) => {
println!("{:s}", usage(PROGRAM, possible_options)); println!("{:s}", usage(PROGRAM, possible_options));
return 0; return 1;
} }
}; };

View file

@ -105,7 +105,7 @@ pub fn uumain(args: Vec<String>) -> int {
Ok(m) => { m }, Ok(m) => { m },
Err(_) => { Err(_) => {
println!("{:s}", usage(NAME, options)); println!("{:s}", usage(NAME, options));
return 0; return 1;
} }
}; };

View file

@ -33,7 +33,7 @@ pub fn uumain(args: Vec<String>) -> int {
let matches = match getopts(args.tail(), options) { let matches = match getopts(args.tail(), options) {
Ok(m) => { m } Ok(m) => { m }
_ => { help(program.as_slice(), options); return 0 } _ => { help(program.as_slice(), options); return 1 }
}; };
if matches.opt_present("h") { if matches.opt_present("h") {

View file

@ -59,6 +59,9 @@ pub fn uumain(args: Vec<String>) -> int {
println!(""); println!("");
println!("{:s}", getopts::usage("Update the access and modification times of \ println!("{:s}", getopts::usage("Update the access and modification times of \
each FILE to the current time.", opts)); each FILE to the current time.", opts));
if matches.free.is_empty() {
return 1;
}
return 0; return 0;
} }