mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 21:47:46 +00:00
uniq, wc: fix build
This commit is contained in:
parent
7860ef275c
commit
c223e28fac
2 changed files with 6 additions and 6 deletions
|
@ -191,24 +191,24 @@ pub fn uumain(args: Vec<String>) -> int {
|
||||||
|
|
||||||
fn open_input_file(in_file_name: String) -> io::BufferedReader<Box<Reader+'static>> {
|
fn open_input_file(in_file_name: String) -> io::BufferedReader<Box<Reader+'static>> {
|
||||||
let in_file = if in_file_name.as_slice() == "-" {
|
let in_file = if in_file_name.as_slice() == "-" {
|
||||||
box io::stdio::stdin_raw() as Box<Reader>
|
Box::new(io::stdio::stdin_raw()) as Box<Reader>
|
||||||
} else {
|
} else {
|
||||||
let path = Path::new(in_file_name);
|
let path = Path::new(in_file_name);
|
||||||
let in_file = io::File::open(&path);
|
let in_file = io::File::open(&path);
|
||||||
let r = crash_if_err!(1, in_file);
|
let r = crash_if_err!(1, in_file);
|
||||||
box r as Box<Reader>
|
Box::new(r) as Box<Reader>
|
||||||
};
|
};
|
||||||
io::BufferedReader::new(in_file)
|
io::BufferedReader::new(in_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_output_file(out_file_name: String) -> io::BufferedWriter<Box<Writer+'static>> {
|
fn open_output_file(out_file_name: String) -> io::BufferedWriter<Box<Writer+'static>> {
|
||||||
let out_file = if out_file_name.as_slice() == "-" {
|
let out_file = if out_file_name.as_slice() == "-" {
|
||||||
box io::stdio::stdout_raw() as Box<Writer>
|
Box::new(io::stdio::stdout_raw()) as Box<Writer>
|
||||||
} else {
|
} else {
|
||||||
let path = Path::new(out_file_name);
|
let path = Path::new(out_file_name);
|
||||||
let in_file = io::File::create(&path);
|
let in_file = io::File::create(&path);
|
||||||
let w = crash_if_err!(1, in_file);
|
let w = crash_if_err!(1, in_file);
|
||||||
box w as Box<Writer>
|
Box::new(w) as Box<Writer>
|
||||||
};
|
};
|
||||||
io::BufferedWriter::new(out_file)
|
io::BufferedWriter::new(out_file)
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ fn print_stats(filename: &str, line_count: uint, word_count: uint, char_count: u
|
||||||
|
|
||||||
fn open(path: &str) -> StdResult<BufferedReader<Box<Reader+'static>>, int> {
|
fn open(path: &str) -> StdResult<BufferedReader<Box<Reader+'static>>, int> {
|
||||||
if "-" == path {
|
if "-" == path {
|
||||||
let reader = box stdin_raw() as Box<Reader>;
|
let reader = Box::new(stdin_raw()) as Box<Reader>;
|
||||||
return Ok(BufferedReader::new(reader));
|
return Ok(BufferedReader::new(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ fn open(path: &str) -> StdResult<BufferedReader<Box<Reader+'static>>, int> {
|
||||||
}
|
}
|
||||||
match File::open(&fpath) {
|
match File::open(&fpath) {
|
||||||
Ok(fd) => {
|
Ok(fd) => {
|
||||||
let reader = box fd as Box<Reader>;
|
let reader = Box::new(fd) as Box<Reader>;
|
||||||
Ok(BufferedReader::new(reader))
|
Ok(BufferedReader::new(reader))
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue