mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
dirname, basename, env, head, id, sync, touch: exit with status 1 on invalid arguments
This commit is contained in:
@@ -62,13 +62,13 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||
if args.len() < 2 {
|
||||
println!("{}: {}", program, "missing operand");
|
||||
println!("Try '{} --help' for more information.", program);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
// too many arguments
|
||||
else if args.len() > 3 {
|
||||
println!("{}: extra operand '{}'", program, args.get(3));
|
||||
println!("Try '{} --help' for more information.", program);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -66,6 +66,7 @@ directory).", opts).as_slice());
|
||||
} else {
|
||||
println!("{0:s}: missing operand", program);
|
||||
println!("Try '{0:s} --help' for more information.", program);
|
||||
return 1;
|
||||
}
|
||||
|
||||
0
|
||||
|
||||
Vendored
+2
-2
@@ -114,7 +114,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||
_ => {
|
||||
println!("{:s}: invalid option \"{:s}\"", prog, *opt);
|
||||
println!("Type \"{:s} --help\" for detailed informations", prog);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} 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!("Type \"{:s} --help\" for detailed informations", prog);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||
Ok (m) => { m }
|
||||
Err(_) => {
|
||||
println!("{:s}", usage(PROGRAM, possible_options));
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||
Ok(m) => { m },
|
||||
Err(_) => {
|
||||
println!("{:s}", usage(NAME, options));
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||
|
||||
let matches = match getopts(args.tail(), options) {
|
||||
Ok(m) => { m }
|
||||
_ => { help(program.as_slice(), options); return 0 }
|
||||
_ => { help(program.as_slice(), options); return 1 }
|
||||
};
|
||||
|
||||
if matches.opt_present("h") {
|
||||
|
||||
@@ -59,6 +59,9 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||
println!("");
|
||||
println!("{:s}", getopts::usage("Update the access and modification times of \
|
||||
each FILE to the current time.", opts));
|
||||
if matches.free.is_empty() {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user