Merge pull request #816 from nathanross/minor-fixes

basename: error message for too few or many args messages should go to stderr
This commit is contained in:
Michael Gehring 2016-02-16 04:00:29 +01:00
commit 76cfcba306

View file

@ -52,15 +52,21 @@ pub fn uumain(args: Vec<String>) -> i32 {
// too few arguments
if args.len() < 2 {
println!("{}: {}", NAME, "missing operand");
println!("Try '{} --help' for more information.", NAME);
return 1;
crash!(
1,
"{0}: {1}\nTry '{0} --help' for more information.",
NAME,
"missing operand"
);
}
// too many arguments
else if args.len() > 3 {
println!("{}: extra operand '{}'", NAME, args[3]);
println!("Try '{} --help' for more information.", NAME);
return 1;
crash!(
1,
"{0}: extra operand '{1}'\nTry '{0} --help' for more information.",
NAME,
args[3]
);
}
//