mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 22:17:45 +00:00
update yes
This commit makes `yes` build on recent nightly.
This commit is contained in:
parent
c50e8ee8cb
commit
de28072140
1 changed files with 6 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
#![crate_name = "yes"]
|
#![crate_name = "yes"]
|
||||||
#![feature(collections, old_io, rustc_private)]
|
#![feature(rustc_private)]
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the uutils coreutils package.
|
* This file is part of the uutils coreutils package.
|
||||||
|
@ -15,8 +15,7 @@
|
||||||
extern crate getopts;
|
extern crate getopts;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
use std::old_io::print;
|
use std::io::Write;
|
||||||
use std::borrow::IntoCow;
|
|
||||||
|
|
||||||
#[path = "../common/util.rs"]
|
#[path = "../common/util.rs"]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
@ -30,7 +29,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
getopts::optflag("h", "help", "display this help and exit"),
|
getopts::optflag("h", "help", "display this help and exit"),
|
||||||
getopts::optflag("V", "version", "output version information and exit"),
|
getopts::optflag("V", "version", "output version information and exit"),
|
||||||
];
|
];
|
||||||
let matches = match getopts::getopts(args.tail(), &opts) {
|
let matches = match getopts::getopts(&args[1..], &opts) {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
crash!(1, "invalid options\n{}", f)
|
crash!(1, "invalid options\n{}", f)
|
||||||
|
@ -42,7 +41,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
println!("Usage:");
|
println!("Usage:");
|
||||||
println!(" {0} [STRING]... [OPTION]...", program);
|
println!(" {0} [STRING]... [OPTION]...", program);
|
||||||
println!("");
|
println!("");
|
||||||
print(&getopts::usage("Repeatedly output a line with all specified STRING(s), or 'y'.", &opts)[..]);
|
print!("{}", getopts::usage("Repeatedly output a line with all specified STRING(s), or 'y'.", &opts));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if matches.opt_present("version") {
|
if matches.opt_present("version") {
|
||||||
|
@ -50,9 +49,9 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
let string = if matches.free.is_empty() {
|
let string = if matches.free.is_empty() {
|
||||||
"y".into_cow()
|
"y".to_string()
|
||||||
} else {
|
} else {
|
||||||
matches.free.connect(" ").into_cow()
|
matches.free.connect(" ")
|
||||||
};
|
};
|
||||||
|
|
||||||
exec(&string[..]);
|
exec(&string[..]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue