mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Fix typo
This commit is contained in:
parent
18acfc0103
commit
4731928558
14 changed files with 37 additions and 37 deletions
|
@ -112,7 +112,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
match cksum("-") {
|
||||
Ok((crc, size)) => println!("{} {}", crc, size),
|
||||
Err(err) => {
|
||||
show_errer!("{}", err);
|
||||
show_error!("{}", err);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
match cksum(fname.as_slice()) {
|
||||
Ok((crc, size)) => println!("{} {} {}", crc, size, fname),
|
||||
Err(err) => {
|
||||
show_errer!("'{}' {}", fname, err);
|
||||
show_error!("'{}' {}", fname, err);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
extern crate libc;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! show_errer(
|
||||
macro_rules! show_error(
|
||||
($($args:expr),+) => ({
|
||||
safe_write!(&mut ::std::io::stderr(), "{}: error: ", ::NAME);
|
||||
safe_writeln!(&mut ::std::io::stderr(), $($args),+);
|
||||
|
|
2
du/du.rs
2
du/du.rs
|
@ -162,7 +162,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let matches = match getopts::getopts(args.tail(), opts) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
show_errer!("Invalid options\n{}", f.to_err_msg());
|
||||
show_error!("Invalid options\n{}", f.to_err_msg());
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let matches = match getopts(args.tail(), options) {
|
||||
Ok(m) => { m },
|
||||
Err(_) => {
|
||||
show_errer!("{}", usage(NAME, options));
|
||||
show_error!("{}", usage(NAME, options));
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -65,7 +65,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let matches = match getopts(args.tail(), opts) {
|
||||
Ok(m) => m,
|
||||
Err(e) => {
|
||||
show_errer!("{}\n{}", e.to_err_msg(), get_help_text(NAME, usage.as_slice()));
|
||||
show_error!("{}\n{}", e.to_err_msg(), get_help_text(NAME, usage.as_slice()));
|
||||
return EXIT_ERR;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -71,7 +71,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let matches = match getopts(args.tail(), opts) {
|
||||
Ok(m) => m,
|
||||
Err(e) => {
|
||||
show_errer!("{}\n{}", e.to_err_msg(), get_help_text(NAME, usage.as_slice()));
|
||||
show_error!("{}\n{}", e.to_err_msg(), get_help_text(NAME, usage.as_slice()));
|
||||
return EXIT_ERR;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -144,7 +144,7 @@ fn exec(dirs: Vec<String>, mk_parents: bool, mode: FilePermission, verbose: bool
|
|||
} else {
|
||||
format!("directory '{}' already exists", *dir)
|
||||
};
|
||||
show_errer!("{}", error_msg);
|
||||
show_error!("{}", error_msg);
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
|
|
14
rm/rm.rs
14
rm/rm.rs
|
@ -79,8 +79,8 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
} else if matches.opt_present("version") {
|
||||
println!("rm 1.0.0");
|
||||
} else if matches.free.is_empty() {
|
||||
show_errer!("missing an argument");
|
||||
show_errer!("for help, try '{0:s} --help'", program);
|
||||
show_error!("missing an argument");
|
||||
show_error!("for help, try '{0:s} --help'", program);
|
||||
return 0;
|
||||
} else {
|
||||
let force = matches.opt_present("force");
|
||||
|
@ -156,11 +156,11 @@ fn remove(files: Vec<String>, force: bool, interactive: InteractiveMode, one_fs:
|
|||
}
|
||||
} else {
|
||||
if recursive {
|
||||
show_errer!("could not remove directory '{}'",
|
||||
show_error!("could not remove directory '{}'",
|
||||
filename);
|
||||
return Err(1);
|
||||
} else {
|
||||
show_errer!("could not remove directory '{}' (did you mean to pass '-r'?)",
|
||||
show_error!("could not remove directory '{}' (did you mean to pass '-r'?)",
|
||||
filename);
|
||||
return Err(1);
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ fn remove(files: Vec<String>, force: bool, interactive: InteractiveMode, one_fs:
|
|||
}
|
||||
}
|
||||
} else if !force {
|
||||
show_errer!("no such file or directory '{}'", filename);
|
||||
show_error!("no such file or directory '{}'", filename);
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ fn remove_dir(path: &Path, name: &str, interactive: InteractiveMode, verbose: bo
|
|||
match fs::rmdir(path) {
|
||||
Ok(_) => if verbose { println!("Removed '{}'", name); },
|
||||
Err(f) => {
|
||||
show_errer!("{}", f.to_str());
|
||||
show_error!("{}", f.to_str());
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ fn remove_file(path: &Path, name: &str, interactive: InteractiveMode, verbose: b
|
|||
match fs::unlink(path) {
|
||||
Ok(_) => if verbose { println!("Removed '{}'", name); },
|
||||
Err(f) => {
|
||||
show_errer!("{}", f.to_str());
|
||||
show_error!("{}", f.to_str());
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let matches = match getopts::getopts(args.tail(), opts) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
show_errer!("{}", f.to_err_msg());
|
||||
show_error!("{}", f.to_err_msg());
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
@ -53,8 +53,8 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
} else if matches.opt_present("version") {
|
||||
println!("rmdir 1.0.0");
|
||||
} else if matches.free.is_empty() {
|
||||
show_errer!("missing an argument");
|
||||
show_errer!("for help, try '{0:s} --help'", program);
|
||||
show_error!("missing an argument");
|
||||
show_error!("for help, try '{0:s} --help'", program);
|
||||
return 1;
|
||||
} else {
|
||||
let ignore = matches.opt_present("ignore-fail-on-non-empty");
|
||||
|
@ -79,11 +79,11 @@ fn remove(dirs: Vec<String>, ignore: bool, parents: bool, verbose: bool) -> Resu
|
|||
Err(e) => return Err(e)
|
||||
}
|
||||
} else {
|
||||
show_errer!("failed to remove '{}' (file)", *dir);
|
||||
show_error!("failed to remove '{}' (file)", *dir);
|
||||
return Err(1);
|
||||
}
|
||||
} else {
|
||||
show_errer!("no such file or directory '{}'", *dir);
|
||||
show_error!("no such file or directory '{}'", *dir);
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ fn remove_dir(path: &Path, dir: &str, ignore: bool, parents: bool, verbose: bool
|
|||
let mut walk_dir = match fs::walk_dir(path) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
show_errer!("{}", f.to_str());
|
||||
show_error!("{}", f.to_str());
|
||||
return Err(1);
|
||||
}
|
||||
};
|
||||
|
@ -116,12 +116,12 @@ fn remove_dir(path: &Path, dir: &str, ignore: bool, parents: bool, verbose: bool
|
|||
}
|
||||
}
|
||||
Err(f) => {
|
||||
show_errer!("{}", f.to_str());
|
||||
show_error!("{}", f.to_str());
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
} else if !ignore {
|
||||
show_errer!("Failed to remove directory '{}' (non-empty)", dir);
|
||||
show_error!("Failed to remove directory '{}' (non-empty)", dir);
|
||||
return Err(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let matches = match getopts::getopts(args.tail(), opts) {
|
||||
Ok(m) => { m }
|
||||
Err(f) => {
|
||||
show_errer!("{:s}", f.to_err_msg());
|
||||
show_error!("{:s}", f.to_err_msg());
|
||||
print_usage(opts);
|
||||
return 1;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let first = if matches.free.len() > 1 {
|
||||
match parse_float(matches.free.get(0).as_slice()) {
|
||||
Ok(n) => n,
|
||||
Err(s) => { show_errer!("{:s}", s); return 1; }
|
||||
Err(s) => { show_error!("{:s}", s); return 1; }
|
||||
}
|
||||
} else {
|
||||
1.0
|
||||
|
@ -75,14 +75,14 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let step = if matches.free.len() > 2 {
|
||||
match parse_float(matches.free.get(1).as_slice()) {
|
||||
Ok(n) => n,
|
||||
Err(s) => { show_errer!("{:s}", s); return 1; }
|
||||
Err(s) => { show_error!("{:s}", s); return 1; }
|
||||
}
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
let last = match parse_float(matches.free.get(matches.free.len()-1).as_slice()) {
|
||||
Ok(n) => n,
|
||||
Err(s) => { show_errer!("{:s}", s); return 1; }
|
||||
Err(s) => { show_error!("{:s}", s); return 1; }
|
||||
};
|
||||
let separator = escape_sequences(matches.opt_str("s").unwrap_or("\n".to_string()).as_slice());
|
||||
let terminator = escape_sequences(matches.opt_str("t").unwrap_or(separator.to_string()).as_slice());
|
||||
|
|
|
@ -36,7 +36,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let matches = match getopts::getopts(args.tail(), opts) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
show_errer!("{}", f.to_err_msg());
|
||||
show_error!("{}", f.to_err_msg());
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
@ -57,8 +57,8 @@ specified by the sum of their values.", opts).as_slice());
|
|||
} else if matches.opt_present("version") {
|
||||
println!("sleep 1.0.0");
|
||||
} else if matches.free.is_empty() {
|
||||
show_errer!("missing an argument");
|
||||
show_errer!("for help, try '{0:s} --help'", program);
|
||||
show_error!("missing an argument");
|
||||
show_error!("for help, try '{0:s} --help'", program);
|
||||
return 1;
|
||||
} else {
|
||||
sleep(matches.free);
|
||||
|
|
4
tr/tr.rs
4
tr/tr.rs
|
@ -161,7 +161,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let matches = match getopts::getopts(args.tail(), opts) {
|
||||
Ok(m) => m,
|
||||
Err(err) => {
|
||||
show_errer!("{}", err.to_err_msg());
|
||||
show_error!("{}", err.to_err_msg());
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
@ -186,7 +186,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
let sets = matches.free;
|
||||
|
||||
if cflag && !dflag {
|
||||
show_errer!("-c is only supported with -d");
|
||||
show_error!("-c is only supported with -d");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ file based on its current size:
|
|||
} else if matches.opt_present("version") {
|
||||
println!("truncate 1.0.0");
|
||||
} else if matches.free.is_empty() {
|
||||
show_errer!("missing an argument");
|
||||
show_error!("missing an argument");
|
||||
return 1;
|
||||
} else {
|
||||
let no_create = matches.opt_present("no-create");
|
||||
|
@ -115,7 +115,7 @@ fn truncate(no_create: bool, _: bool, reference: Option<String>, size: Option<St
|
|||
match fs::stat(rfile.path()) {
|
||||
Ok(stat) => (stat.size, Reference),
|
||||
Err(f) => {
|
||||
show_errer!("{}", f.to_str());
|
||||
show_error!("{}", f.to_str());
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
|
@ -147,13 +147,13 @@ fn truncate(no_create: bool, _: bool, reference: Option<String>, size: Option<St
|
|||
match file.truncate(tsize as i64) {
|
||||
Ok(_) => {}
|
||||
Err(f) => {
|
||||
show_errer!("{}", f.to_str());
|
||||
show_error!("{}", f.to_str());
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(f) => {
|
||||
show_errer!("{}", f.to_str());
|
||||
show_error!("{}", f.to_str());
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
|
|
2
wc/wc.rs
2
wc/wc.rs
|
@ -244,7 +244,7 @@ fn open(path: String) -> StdResult<BufferedReader<Box<Reader>>, int> {
|
|||
return Ok(BufferedReader::new(reader));
|
||||
},
|
||||
Err(e) => {
|
||||
show_errer!("wc: {0:s}: {1:s}", path, e.desc.to_str());
|
||||
show_error!("wc: {0:s}: {1:s}", path, e.desc.to_str());
|
||||
return Err(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue