mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 05:27:45 +00:00
Make 'yes' 1000 times faster.
This commit is contained in:
parent
f2b952db54
commit
fe87116431
1 changed files with 9 additions and 1 deletions
|
@ -22,6 +22,8 @@ use std::io::Write;
|
|||
static NAME: &'static str = "yes";
|
||||
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
const BUF_SIZE: usize = 8192;
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let mut opts = Options::new();
|
||||
|
||||
|
@ -51,7 +53,13 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
matches.free.join(" ")
|
||||
};
|
||||
|
||||
exec(&string[..]);
|
||||
let mut multistring = string.clone();
|
||||
while multistring.len() < BUF_SIZE - string.len() - 1 {
|
||||
multistring.push_str("\n");
|
||||
multistring.push_str(&string);
|
||||
}
|
||||
|
||||
exec(&multistring[..]);
|
||||
|
||||
0
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue