mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 23:32:39 +00:00
Merge pull request #386 from ebfe/fix-build-master
Partially fix build with rust master
This commit is contained in:
commit
80810da987
8 changed files with 10 additions and 12 deletions
2
deps/rust-crypto
vendored
2
deps/rust-crypto
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 24f91a8194440af39a017ef25a13c1db1d4a8f4f
|
||||
Subproject commit 44317cac3c4b36a95ebd5654acbf0e1fff9c4b2e
|
|
@ -105,7 +105,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
return 0;
|
||||
}
|
||||
|
||||
fn open(path: String) -> io::BufferedReader<Box<Reader>> {
|
||||
fn open(path: String) -> io::BufferedReader<Box<Reader+'static>> {
|
||||
let mut file_buf;
|
||||
if path.as_slice() == "-" {
|
||||
io::BufferedReader::new(box io::stdio::stdin_raw() as Box<Reader>)
|
||||
|
|
|
@ -59,7 +59,7 @@ fn get_algo_opts(program: &str) -> Vec<getopts::OptGroup> {
|
|||
}
|
||||
}
|
||||
|
||||
fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box<Digest>) {
|
||||
fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box<Digest+'static>) {
|
||||
let mut alg: Option<Box<Digest>> = None;
|
||||
let mut name: &'static str = "";
|
||||
match program {
|
||||
|
@ -71,7 +71,7 @@ fn detect_algo(program: &str, matches: &getopts::Matches) -> (&'static str, Box<
|
|||
"sha512sum" => ("SHA512", box Sha512::new() as Box<Digest>),
|
||||
_ => {
|
||||
{
|
||||
let set_or_crash = |n: &'static str, val: Box<Digest>| -> () {
|
||||
let set_or_crash = |n, val| -> () {
|
||||
if alg.is_some() { crash!(1, "You cannot combine multiple hash algorithms!") };
|
||||
name = n;
|
||||
alg = Some(val);
|
||||
|
|
|
@ -80,8 +80,7 @@ fn sleep(args: Vec<String>) {
|
|||
let sleep_dur = if sleep_time == f64::INFINITY {
|
||||
duration::MAX
|
||||
} else {
|
||||
let (days, secs, millis) = (sleep_time / 86400., sleep_time % 86400., (sleep_time * 1_000.) % 1_000.);
|
||||
Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32)
|
||||
Duration::seconds(sleep_time as i64)
|
||||
};
|
||||
timer::sleep(sleep_dur);
|
||||
}
|
||||
|
|
|
@ -170,8 +170,7 @@ fn tail<T: Reader> (reader: &mut BufferedReader<T>, line_count:uint, follow:bool
|
|||
|
||||
// if we follow the file, sleep a bit and print the rest if the file has grown.
|
||||
while follow {
|
||||
let (days, secs, millis) = ((sleep_msec / 1000) / 86400, (sleep_msec / 1000) % 86400, sleep_msec % 1000);
|
||||
sleep(Duration::days(days as i32) + Duration::seconds(secs as i32) + Duration::milliseconds(millis as i32));
|
||||
sleep(Duration::milliseconds(sleep_msec as i64));
|
||||
for io_line in reader.lines() {
|
||||
match io_line {
|
||||
Ok(line) => print!("{}", line),
|
||||
|
|
|
@ -107,7 +107,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
return 0;
|
||||
}
|
||||
|
||||
fn open(path: String) -> io::BufferedReader<Box<Reader>> {
|
||||
fn open(path: String) -> io::BufferedReader<Box<Reader+'static>> {
|
||||
let mut file_buf;
|
||||
if path.as_slice() == "-" {
|
||||
io::BufferedReader::new(box io::stdio::stdin_raw() as Box<Reader>)
|
||||
|
|
|
@ -190,7 +190,7 @@ pub fn uumain(args: Vec<String>) -> int {
|
|||
0
|
||||
}
|
||||
|
||||
fn open_input_file(in_file_name: String) -> io::BufferedReader<Box<Reader>> {
|
||||
fn open_input_file(in_file_name: String) -> io::BufferedReader<Box<Reader+'static>> {
|
||||
let in_file = if in_file_name.as_slice() == "-" {
|
||||
box io::stdio::stdin_raw() as Box<Reader>
|
||||
} else {
|
||||
|
@ -201,7 +201,7 @@ fn open_input_file(in_file_name: String) -> io::BufferedReader<Box<Reader>> {
|
|||
io::BufferedReader::new(in_file)
|
||||
}
|
||||
|
||||
fn open_output_file(out_file_name: String) -> io::BufferedWriter<Box<Writer>> {
|
||||
fn open_output_file(out_file_name: String) -> io::BufferedWriter<Box<Writer+'static>> {
|
||||
let out_file = if out_file_name.as_slice() == "-" {
|
||||
box io::stdio::stdout_raw() as Box<Writer>
|
||||
} else {
|
||||
|
|
|
@ -230,7 +230,7 @@ fn print_stats(filename: &str, line_count: uint, word_count: uint, char_count: u
|
|||
}
|
||||
}
|
||||
|
||||
fn open(path: String) -> StdResult<BufferedReader<Box<Reader>>, int> {
|
||||
fn open(path: String) -> StdResult<BufferedReader<Box<Reader+'static>>, int> {
|
||||
if "-" == path.as_slice() {
|
||||
let reader = box stdin_raw() as Box<Reader>;
|
||||
return Ok(BufferedReader::new(reader));
|
||||
|
|
Loading…
Reference in a new issue