mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 04:27:45 +00:00
commit
6b548acc6c
82 changed files with 213 additions and 213 deletions
2
deps/regex
vendored
2
deps/regex
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 10edff6bb76f1c9f4423f3bb8ad373d0c7a69773
|
||||
Subproject commit 6c0f8aa82582441e9cb3813048ef9b098c026db0
|
2
deps/rust-crypto
vendored
2
deps/rust-crypto
vendored
|
@ -1 +1 @@
|
|||
Subproject commit d80341c5169649e88f2e89139049c596874803ab
|
||||
Subproject commit bdc3371e7c70f8df17b9546bf1ae29dd4a3e3743
|
2
deps/time
vendored
2
deps/time
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 9012258dcbf6416909b57205b928c4a5f048881e
|
||||
Subproject commit e216d0de7377a1ae5c8617f6e1a9f60dc61d7ec7
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::{File, Truncate, ReadWrite};
|
||||
use std::old_io::{File, Truncate, ReadWrite};
|
||||
use std::os;
|
||||
use std::path::Path;
|
||||
|
||||
|
@ -30,7 +30,7 @@ fn main() {
|
|||
let main = TEMPLATE.replace("@UTIL_CRATE@", crat);
|
||||
let mut out = File::open_mode(&Path::new(outfile), Truncate, ReadWrite);
|
||||
|
||||
match out.write(main.as_bytes()) {
|
||||
match out.write_all(main.as_bytes()) {
|
||||
Err(e) => panic!("{}", e),
|
||||
_ => (),
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::{File, Truncate, Write};
|
||||
use std::old_io::{File, Truncate, Write};
|
||||
use std::os;
|
||||
use std::path::Path;
|
||||
|
||||
|
@ -45,7 +45,7 @@ fn main() {
|
|||
let mut input = File::open(&Path::new("src/uutils/uutils.rs")).unwrap();
|
||||
let main = input.read_to_string().unwrap().replace("@CRATES@", crates.as_slice()).replace("@UTIL_MAP@", util_map.as_slice());
|
||||
|
||||
match out.write(main.as_bytes()) {
|
||||
match out.write_all(main.as_bytes()) {
|
||||
Err(e) => panic!("{}", e),
|
||||
_ => (),
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ extern crate libc;
|
|||
|
||||
use std::ascii::AsciiExt;
|
||||
use std::error::Error;
|
||||
use std::io::{println, File, stdout};
|
||||
use std::io::stdio::stdin_raw;
|
||||
use std::old_io::{println, File, stdout};
|
||||
use std::old_io::stdio::stdin_raw;
|
||||
|
||||
use getopts::{
|
||||
getopts,
|
||||
|
@ -119,7 +119,7 @@ fn decode(input: &mut Reader, ignore_garbage: bool) {
|
|||
Ok(bytes) => {
|
||||
let mut out = stdout();
|
||||
|
||||
match out.write(bytes.as_slice()) {
|
||||
match out.write_all(bytes.as_slice()) {
|
||||
Ok(_) => {}
|
||||
Err(f) => { crash!(1, "{}", f); }
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
use std::io::{print, println};
|
||||
use std::old_io::{print, println};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::{print, File};
|
||||
use std::io::stdio::{stdout_raw, stdin_raw, stderr};
|
||||
use std::io::{IoResult};
|
||||
use std::old_io::{print, File};
|
||||
use std::old_io::stdio::{stdout_raw, stdin_raw, stderr};
|
||||
use std::old_io::{IoResult};
|
||||
use std::ptr::{copy_nonoverlapping_memory};
|
||||
|
||||
pub fn uumain(args: Vec<String>) -> isize {
|
||||
|
@ -135,7 +135,7 @@ fn write_lines(files: Vec<String>, number: NumberingMode, squeeze_blank: bool,
|
|||
}
|
||||
match in_buf[pos..].iter().position(|c| *c == '\n' as u8) {
|
||||
Some(p) => {
|
||||
writer.write(&in_buf[pos..pos + p]).unwrap();
|
||||
writer.write_all(&in_buf[pos..pos + p]).unwrap();
|
||||
if show_ends {
|
||||
writer.write_u8('$' as u8).unwrap();
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ fn write_lines(files: Vec<String>, number: NumberingMode, squeeze_blank: bool,
|
|||
at_line_start = true;
|
||||
},
|
||||
None => {
|
||||
writer.write(&in_buf[pos..]).unwrap();
|
||||
writer.write_all(&in_buf[pos..]).unwrap();
|
||||
at_line_start = false;
|
||||
break;
|
||||
}
|
||||
|
@ -218,8 +218,8 @@ fn write_bytes(files: Vec<String>, number: NumberingMode, squeeze_blank: bool,
|
|||
_ => byte,
|
||||
};
|
||||
match byte {
|
||||
0 ... 31 => writer.write(&['^' as u8, byte + 64]),
|
||||
127 => writer.write(&['^' as u8, byte - 64]),
|
||||
0 ... 31 => writer.write_all(&['^' as u8, byte + 64]),
|
||||
127 => writer.write_all(&['^' as u8, byte - 64]),
|
||||
_ => writer.write_u8(byte),
|
||||
}
|
||||
} else {
|
||||
|
@ -238,7 +238,7 @@ fn write_fast(files: Vec<String>) {
|
|||
while let Ok(n) = reader.read(&mut in_buf) {
|
||||
if n == 0 { break }
|
||||
// This interface is completely broken.
|
||||
writer.write(&in_buf[..n]).unwrap();
|
||||
writer.write_all(&in_buf[..n]).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ impl<'a, W: Writer> UnsafeWriter<'a, W> {
|
|||
|
||||
fn flush_buf(&mut self) -> IoResult<()> {
|
||||
if self.pos != 0 {
|
||||
let ret = self.inner.write(&self.buf[..self.pos]);
|
||||
let ret = self.inner.write_all(&self.buf[..self.pos]);
|
||||
self.pos = 0;
|
||||
ret
|
||||
} else {
|
||||
|
@ -301,7 +301,7 @@ impl<'a, W: Writer> UnsafeWriter<'a, W> {
|
|||
|
||||
fn possibly_flush(&mut self) {
|
||||
if self.pos > self.threshold {
|
||||
self.inner.write(&self.buf[..self.pos]).unwrap();
|
||||
self.inner.write_all(&self.buf[..self.pos]).unwrap();
|
||||
self.pos = 0;
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ fn fail() -> ! {
|
|||
}
|
||||
|
||||
impl<'a, W: Writer> Writer for UnsafeWriter<'a, W> {
|
||||
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
let dst = &mut self.buf[self.pos..];
|
||||
if buf.len() > dst.len() {
|
||||
fail();
|
||||
|
|
|
@ -19,9 +19,9 @@ extern crate regex;
|
|||
#[plugin] #[no_link] extern crate regex_macros;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::io::fs;
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::io::IoError;
|
||||
use std::old_io::fs;
|
||||
use std::old_io::fs::PathExtensions;
|
||||
use std::old_io::IoError;
|
||||
use std::mem;
|
||||
use std::num::from_str_radix;
|
||||
use regex::Regex;
|
||||
|
|
|
@ -17,7 +17,7 @@ use getopts::{optflag, optopt, getopts, usage};
|
|||
use c_types::{get_pw_from_args, get_group};
|
||||
use libc::funcs::posix88::unistd::{execvp, setuid, setgid};
|
||||
use std::ffi::{c_str_to_bytes, CString};
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::fs::PathExtensions;
|
||||
use std::iter::FromIterator;
|
||||
|
||||
#[path = "../common/util.rs"] #[macro_use] mod util;
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::{EndOfFile, File, IoError, IoResult, print};
|
||||
use std::io::stdio::stdin_raw;
|
||||
use std::old_io::{EndOfFile, File, IoError, IoResult, print};
|
||||
use std::old_io::stdio::stdin_raw;
|
||||
use std::mem;
|
||||
|
||||
use crc_table::CRC_TABLE;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use std::io;
|
||||
use std::old_io as io;
|
||||
|
||||
static CRC_TABLE_LEN: usize = 256;
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
extern crate getopts;
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::io::{BufferedReader, IoResult, print};
|
||||
use std::io::fs::File;
|
||||
use std::io::stdio::{stdin, StdinReader};
|
||||
use std::old_io::{BufferedReader, IoResult, print};
|
||||
use std::old_io::fs::File;
|
||||
use std::old_io::stdio::{stdin, StdinReader};
|
||||
use std::path::Path;
|
||||
|
||||
static NAME : &'static str = "comm";
|
||||
|
@ -102,7 +102,7 @@ fn open_file(name: &str) -> IoResult<LineReader> {
|
|||
match name {
|
||||
"-" => Ok(LineReader::Stdin(stdin())),
|
||||
_ => {
|
||||
let f = try!(std::io::File::open(&Path::new(name)));
|
||||
let f = try!(std::old_io::File::open(&Path::new(name)));
|
||||
Ok(LineReader::FileIn(BufferedReader::new(f)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,35 +11,35 @@ extern crate libc;
|
|||
|
||||
macro_rules! show_error(
|
||||
($($args:tt)+) => ({
|
||||
pipe_write!(&mut ::std::io::stderr(), "{}: error: ", ::NAME);
|
||||
pipe_writeln!(&mut ::std::io::stderr(), $($args)+);
|
||||
pipe_write!(&mut ::std::old_io::stderr(), "{}: error: ", ::NAME);
|
||||
pipe_writeln!(&mut ::std::old_io::stderr(), $($args)+);
|
||||
})
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! show_warning(
|
||||
($($args:tt)+) => ({
|
||||
pipe_write!(&mut ::std::io::stderr(), "{}: warning: ", ::NAME);
|
||||
pipe_writeln!(&mut ::std::io::stderr(), $($args)+);
|
||||
pipe_write!(&mut ::std::old_io::stderr(), "{}: warning: ", ::NAME);
|
||||
pipe_writeln!(&mut ::std::old_io::stderr(), $($args)+);
|
||||
})
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! show_info(
|
||||
($($args:tt)+) => ({
|
||||
pipe_write!(&mut ::std::io::stderr(), "{}: ", ::NAME);
|
||||
pipe_writeln!(&mut ::std::io::stderr(), $($args)+);
|
||||
pipe_write!(&mut ::std::old_io::stderr(), "{}: ", ::NAME);
|
||||
pipe_writeln!(&mut ::std::old_io::stderr(), $($args)+);
|
||||
})
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! eprint(
|
||||
($($args:tt)+) => (pipe_write!(&mut ::std::io::stderr(), $($args)+))
|
||||
($($args:tt)+) => (pipe_write!(&mut ::std::old_io::stderr(), $($args)+))
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! eprintln(
|
||||
($($args:tt)+) => (pipe_writeln!(&mut ::std::io::stderr(), $($args)+))
|
||||
($($args:tt)+) => (pipe_writeln!(&mut ::std::old_io::stderr(), $($args)+))
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
|
@ -85,10 +85,10 @@ macro_rules! return_if_err(
|
|||
#[macro_export]
|
||||
macro_rules! pipe_print(
|
||||
($($args:tt)+) => (
|
||||
match write!(&mut ::std::io::stdout(), $($args)+) {
|
||||
match write!(&mut ::std::old_io::stdout(), $($args)+) {
|
||||
Ok(_) => true,
|
||||
Err(f) => {
|
||||
if f.kind == ::std::io::BrokenPipe {
|
||||
if f.kind == ::std::old_io::BrokenPipe {
|
||||
false
|
||||
} else {
|
||||
panic!("{}", f)
|
||||
|
@ -101,10 +101,10 @@ macro_rules! pipe_print(
|
|||
#[macro_export]
|
||||
macro_rules! pipe_println(
|
||||
($($args:tt)+) => (
|
||||
match writeln!(&mut ::std::io::stdout(), $($args)+) {
|
||||
match writeln!(&mut ::std::old_io::stdout(), $($args)+) {
|
||||
Ok(_) => true,
|
||||
Err(f) => {
|
||||
if f.kind == ::std::io::BrokenPipe {
|
||||
if f.kind == ::std::old_io::BrokenPipe {
|
||||
false
|
||||
} else {
|
||||
panic!("{}", f)
|
||||
|
@ -120,7 +120,7 @@ macro_rules! pipe_write(
|
|||
match write!($fd, $($args)+) {
|
||||
Ok(_) => true,
|
||||
Err(f) => {
|
||||
if f.kind == ::std::io::BrokenPipe {
|
||||
if f.kind == ::std::old_io::BrokenPipe {
|
||||
false
|
||||
} else {
|
||||
panic!("{}", f)
|
||||
|
@ -136,7 +136,7 @@ macro_rules! pipe_writeln(
|
|||
match writeln!($fd, $($args)+) {
|
||||
Ok(_) => true,
|
||||
Err(f) => {
|
||||
if f.kind == ::std::io::BrokenPipe {
|
||||
if f.kind == ::std::old_io::BrokenPipe {
|
||||
false
|
||||
} else {
|
||||
panic!("{}", f)
|
||||
|
|
|
@ -14,8 +14,8 @@ extern crate getopts;
|
|||
#[macro_use] extern crate log;
|
||||
|
||||
use std::os;
|
||||
use std::io;
|
||||
use std::io::fs;
|
||||
use std::old_io as io;
|
||||
use std::old_io::fs;
|
||||
|
||||
use getopts::{
|
||||
getopts,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std;
|
||||
use std::io::{IoResult, IoError};
|
||||
use std::old_io::{IoResult, IoError};
|
||||
|
||||
pub struct BufReader<R> {
|
||||
reader: R,
|
||||
|
@ -66,7 +66,7 @@ impl<R: Reader> BufReader<R> {
|
|||
|
||||
loop {
|
||||
match self.maybe_fill_buf() {
|
||||
Ok(0) | Err(IoError { kind: std::io::EndOfFile, .. })
|
||||
Ok(0) | Err(IoError { kind: std::old_io::EndOfFile, .. })
|
||||
if self.start == self.end => return bytes_consumed,
|
||||
Err(err) => panic!("read error: {}", err.desc),
|
||||
_ => ()
|
||||
|
@ -93,7 +93,7 @@ impl<R: Reader> BufReader<R> {
|
|||
impl<R: Reader> Bytes::Select for BufReader<R> {
|
||||
fn select<'a>(&'a mut self, bytes: usize) -> Bytes::Selected<'a> {
|
||||
match self.maybe_fill_buf() {
|
||||
Err(IoError { kind: std::io::EndOfFile, .. }) => (),
|
||||
Err(IoError { kind: std::old_io::EndOfFile, .. }) => (),
|
||||
Err(err) => panic!("read error: {}", err.desc),
|
||||
_ => ()
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::{stdio, File, BufferedWriter, BufferedReader, print};
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::{stdio, File, BufferedWriter, BufferedReader, print};
|
||||
use std::old_io::fs::PathExtensions;
|
||||
use getopts::{optopt, optflag, getopts, usage};
|
||||
|
||||
use ranges::Range;
|
||||
|
@ -71,7 +71,7 @@ fn cut_bytes<R: Reader>(reader: R,
|
|||
loop {
|
||||
match buf_read.select(low - cur_pos) {
|
||||
NewlineFound(_) => {
|
||||
out.write(&[b'\n']).unwrap();
|
||||
out.write_all(&[b'\n']).unwrap();
|
||||
continue 'newline
|
||||
}
|
||||
Complete(bytes) => {
|
||||
|
@ -81,7 +81,7 @@ fn cut_bytes<R: Reader>(reader: R,
|
|||
Partial(bytes) => cur_pos += bytes.len(),
|
||||
EndOfFile => {
|
||||
if orig_pos != cur_pos {
|
||||
out.write(&[b'\n']).unwrap();
|
||||
out.write_all(&[b'\n']).unwrap();
|
||||
}
|
||||
|
||||
break 'newline
|
||||
|
@ -92,7 +92,7 @@ fn cut_bytes<R: Reader>(reader: R,
|
|||
match opts.out_delim {
|
||||
Some(ref delim) => {
|
||||
if print_delim {
|
||||
out.write(delim.as_bytes()).unwrap();
|
||||
out.write_all(delim.as_bytes()).unwrap();
|
||||
}
|
||||
print_delim = true;
|
||||
}
|
||||
|
@ -103,21 +103,21 @@ fn cut_bytes<R: Reader>(reader: R,
|
|||
loop {
|
||||
match buf_read.select(high - cur_pos + 1) {
|
||||
NewlineFound(bytes) => {
|
||||
out.write(bytes).unwrap();
|
||||
out.write_all(bytes).unwrap();
|
||||
continue 'newline
|
||||
}
|
||||
Complete(bytes) => {
|
||||
out.write(bytes).unwrap();
|
||||
out.write_all(bytes).unwrap();
|
||||
cur_pos = high + 1;
|
||||
break
|
||||
}
|
||||
Partial(bytes) => {
|
||||
cur_pos += bytes.len();
|
||||
out.write(bytes).unwrap();
|
||||
out.write_all(bytes).unwrap();
|
||||
}
|
||||
EndOfFile => {
|
||||
if cur_pos != low || low == high {
|
||||
out.write(&[b'\n']).unwrap();
|
||||
out.write_all(&[b'\n']).unwrap();
|
||||
}
|
||||
|
||||
break 'newline
|
||||
|
@ -127,7 +127,7 @@ fn cut_bytes<R: Reader>(reader: R,
|
|||
}
|
||||
|
||||
buf_read.consume_line();
|
||||
out.write(&[b'\n']).unwrap();
|
||||
out.write_all(&[b'\n']).unwrap();
|
||||
}
|
||||
|
||||
0
|
||||
|
@ -142,7 +142,7 @@ fn cut_characters<R: Reader>(reader: R,
|
|||
'newline: loop {
|
||||
let line = match buf_in.read_line() {
|
||||
Ok(line) => line,
|
||||
Err(std::io::IoError { kind: std::io::EndOfFile, .. }) => break,
|
||||
Err(std::old_io::IoError { kind: std::old_io::EndOfFile, .. }) => break,
|
||||
_ => panic!(),
|
||||
};
|
||||
|
||||
|
@ -159,7 +159,7 @@ fn cut_characters<R: Reader>(reader: R,
|
|||
match opts.out_delim {
|
||||
Some(ref delim) => {
|
||||
if print_delim {
|
||||
out.write(delim.as_bytes()).unwrap();
|
||||
out.write_all(delim.as_bytes()).unwrap();
|
||||
}
|
||||
print_delim = true;
|
||||
}
|
||||
|
@ -170,13 +170,13 @@ fn cut_characters<R: Reader>(reader: R,
|
|||
Some((high_idx, _)) => {
|
||||
let segment = &line.as_bytes()[low_idx..high_idx];
|
||||
|
||||
out.write(segment).unwrap();
|
||||
out.write_all(segment).unwrap();
|
||||
}
|
||||
None => {
|
||||
let bytes = line.as_bytes();
|
||||
let segment = &bytes[low_idx..];
|
||||
|
||||
out.write(segment).unwrap();
|
||||
out.write_all(segment).unwrap();
|
||||
|
||||
if line.as_bytes()[bytes.len() - 1] == b'\n' {
|
||||
continue 'newline
|
||||
|
@ -186,7 +186,7 @@ fn cut_characters<R: Reader>(reader: R,
|
|||
|
||||
char_pos = high + 1;
|
||||
}
|
||||
out.write(&[b'\n']).unwrap();
|
||||
out.write_all(&[b'\n']).unwrap();
|
||||
}
|
||||
|
||||
0
|
||||
|
@ -249,7 +249,7 @@ fn cut_fields_delimiter<R: Reader>(reader: R,
|
|||
'newline: loop {
|
||||
let line = match buf_in.read_until(b'\n') {
|
||||
Ok(line) => line,
|
||||
Err(std::io::IoError { kind: std::io::EndOfFile, .. }) => break,
|
||||
Err(std::old_io::IoError { kind: std::old_io::EndOfFile, .. }) => break,
|
||||
_ => panic!(),
|
||||
};
|
||||
|
||||
|
@ -261,9 +261,9 @@ fn cut_fields_delimiter<R: Reader>(reader: R,
|
|||
|
||||
if delim_search.peek().is_none() {
|
||||
if ! only_delimited {
|
||||
out.write(line.as_slice()).unwrap();
|
||||
out.write_all(line.as_slice()).unwrap();
|
||||
if line[line.len() - 1] != b'\n' {
|
||||
out.write(&[b'\n']).unwrap();
|
||||
out.write_all(&[b'\n']).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ fn cut_fields_delimiter<R: Reader>(reader: R,
|
|||
Some((high_idx, next_low_idx)) => {
|
||||
let segment = &line[low_idx..high_idx];
|
||||
|
||||
out.write(segment).unwrap();
|
||||
out.write_all(segment).unwrap();
|
||||
|
||||
print_delim = true;
|
||||
|
||||
|
@ -297,7 +297,7 @@ fn cut_fields_delimiter<R: Reader>(reader: R,
|
|||
None => {
|
||||
let segment = &line[low_idx..];
|
||||
|
||||
out.write(segment).unwrap();
|
||||
out.write_all(segment).unwrap();
|
||||
|
||||
if line[line.len() - 1] == b'\n' {
|
||||
continue 'newline
|
||||
|
@ -308,7 +308,7 @@ fn cut_fields_delimiter<R: Reader>(reader: R,
|
|||
}
|
||||
}
|
||||
|
||||
out.write(&[b'\n']).unwrap();
|
||||
out.write_all(&[b'\n']).unwrap();
|
||||
}
|
||||
|
||||
0
|
||||
|
@ -331,7 +331,7 @@ fn cut_fields<R: Reader>(reader: R,
|
|||
'newline: loop {
|
||||
let line = match buf_in.read_until(b'\n') {
|
||||
Ok(line) => line,
|
||||
Err(std::io::IoError { kind: std::io::EndOfFile, .. }) => break,
|
||||
Err(std::old_io::IoError { kind: std::old_io::EndOfFile, .. }) => break,
|
||||
_ => panic!(),
|
||||
};
|
||||
|
||||
|
@ -343,9 +343,9 @@ fn cut_fields<R: Reader>(reader: R,
|
|||
|
||||
if delim_search.peek().is_none() {
|
||||
if ! opts.only_delimited {
|
||||
out.write(line.as_slice()).unwrap();
|
||||
out.write_all(line.as_slice()).unwrap();
|
||||
if line[line.len() - 1] != b'\n' {
|
||||
out.write(&[b'\n']).unwrap();
|
||||
out.write_all(&[b'\n']).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ fn cut_fields<R: Reader>(reader: R,
|
|||
Some((high_idx, next_low_idx)) => {
|
||||
let segment = &line[low_idx..high_idx];
|
||||
|
||||
out.write(segment).unwrap();
|
||||
out.write_all(segment).unwrap();
|
||||
|
||||
print_delim = true;
|
||||
low_idx = next_low_idx;
|
||||
|
@ -379,7 +379,7 @@ fn cut_fields<R: Reader>(reader: R,
|
|||
None => {
|
||||
let segment = &line[low_idx..line.len()];
|
||||
|
||||
out.write(segment).unwrap();
|
||||
out.write_all(segment).unwrap();
|
||||
|
||||
if line[line.len() - 1] == b'\n' {
|
||||
continue 'newline
|
||||
|
@ -389,7 +389,7 @@ fn cut_fields<R: Reader>(reader: R,
|
|||
}
|
||||
}
|
||||
|
||||
out.write(&[b'\n']).unwrap();
|
||||
out.write_all(&[b'\n']).unwrap();
|
||||
}
|
||||
|
||||
0
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::print;
|
||||
use std::old_io::print;
|
||||
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
extern crate time;
|
||||
|
||||
use std::io::{stderr, fs, FileStat, FileType};
|
||||
use std::old_io::{stderr, fs, FileStat, FileType};
|
||||
use std::num::Float;
|
||||
use std::option::Option;
|
||||
use std::path::Path;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::{print, println};
|
||||
use std::old_io::{print, println};
|
||||
use std::num::from_str_radix;
|
||||
use std::str::from_utf8;
|
||||
|
||||
|
|
4
src/env/env.rs
vendored
4
src/env/env.rs
vendored
|
@ -192,13 +192,13 @@ pub fn uumain(args: Vec<String>) -> isize {
|
|||
}
|
||||
|
||||
if opts.program.len() >= 1 {
|
||||
use std::io::process::{Command, InheritFd};
|
||||
use std::old_io::process::{Command, InheritFd};
|
||||
let prog = opts.program[0].clone();
|
||||
let args = &opts.program[1..];
|
||||
match Command::new(prog).args(args).stdin(InheritFd(0)).stdout(InheritFd(1)).stderr(InheritFd(2)).status() {
|
||||
Ok(exit) =>
|
||||
return match exit {
|
||||
std::io::process::ExitStatus(s) => s,
|
||||
std::old_io::process::ExitStatus(s) => s,
|
||||
_ => 1
|
||||
},
|
||||
Err(_) => return 1
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::old_io as io;
|
||||
use std::str::StrExt;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
|
|
@ -14,8 +14,8 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::vec::Vec;
|
||||
use std::io::BufferedReader;
|
||||
use std::io::stdio::stdin_raw;
|
||||
use std::old_io::BufferedReader;
|
||||
use std::old_io::stdio::stdin_raw;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -17,8 +17,8 @@ extern crate getopts;
|
|||
extern crate unicode;
|
||||
|
||||
use std::cmp;
|
||||
use std::io::{BufferedReader, BufferedWriter, File, IoResult};
|
||||
use std::io::stdio::{stdin_raw, stdout_raw};
|
||||
use std::old_io::{BufferedReader, BufferedWriter, File, IoResult};
|
||||
use std::old_io::stdio::{stdin_raw, stdout_raw};
|
||||
use linebreak::break_lines;
|
||||
use parasplit::ParagraphStream;
|
||||
|
||||
|
@ -207,7 +207,7 @@ pub fn uumain(args: Vec<String>) -> isize {
|
|||
let mut p_stream = ParagraphStream::new(&fmt_opts, &mut fp);
|
||||
for para_result in p_stream {
|
||||
match para_result {
|
||||
Err(s) => silent_unwrap!(ostream.write(s.as_bytes())),
|
||||
Err(s) => silent_unwrap!(ostream.write_all(s.as_bytes())),
|
||||
Ok(para) => break_lines(¶, &fmt_opts, &mut ostream)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,18 +60,18 @@ pub fn break_lines(para: &Paragraph, opts: &FmtOptions, ostream: &mut Box<Writer
|
|||
let p_init_len = w_len +
|
||||
if opts.crown || opts.tagged {
|
||||
// handle "init" portion
|
||||
silent_unwrap!(ostream.write(para.init_str.as_bytes()));
|
||||
silent_unwrap!(ostream.write_all(para.init_str.as_bytes()));
|
||||
para.init_len
|
||||
} else if !para.mail_header {
|
||||
// for non-(crown, tagged) that's the same as a normal indent
|
||||
silent_unwrap!(ostream.write(p_indent.as_bytes()));
|
||||
silent_unwrap!(ostream.write_all(p_indent.as_bytes()));
|
||||
p_indent_len
|
||||
} else {
|
||||
// except that mail headers get no indent at all
|
||||
0
|
||||
};
|
||||
// write first word after writing init
|
||||
silent_unwrap!(ostream.write(w.as_bytes()));
|
||||
silent_unwrap!(ostream.write_all(w.as_bytes()));
|
||||
|
||||
// does this paragraph require uniform spacing?
|
||||
let uniform = para.mail_header || opts.uniform;
|
||||
|
@ -437,16 +437,16 @@ fn slice_if_fresh<'a>(fresh: bool, word: &'a str, start: usize, uniform: bool, n
|
|||
#[inline(always)]
|
||||
fn write_newline(indent: &str, ostream: &mut Box<Writer>) {
|
||||
silent_unwrap!(ostream.write_char('\n'));
|
||||
silent_unwrap!(ostream.write(indent.as_bytes()));
|
||||
silent_unwrap!(ostream.write_all(indent.as_bytes()));
|
||||
}
|
||||
|
||||
// Write the word, along with slen spaces.
|
||||
#[inline(always)]
|
||||
fn write_with_spaces(word: &str, slen: usize, ostream: &mut Box<Writer>) {
|
||||
if slen == 2 {
|
||||
silent_unwrap!(ostream.write(" ".as_bytes()));
|
||||
silent_unwrap!(ostream.write_all(" ".as_bytes()));
|
||||
} else if slen == 1 {
|
||||
silent_unwrap!(ostream.write_char(' '));
|
||||
}
|
||||
silent_unwrap!(ostream.write(word.as_bytes()));
|
||||
silent_unwrap!(ostream.write_all(word.as_bytes()));
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
use core::iter::Peekable;
|
||||
use std::io::Lines;
|
||||
use std::old_io::Lines;
|
||||
use std::slice::Iter;
|
||||
use std::str::CharRange;
|
||||
use unicode::str::UnicodeStr;
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::io::fs::File;
|
||||
use std::io::BufferedReader;
|
||||
use std::old_io as io;
|
||||
use std::old_io::fs::File;
|
||||
use std::old_io::BufferedReader;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -18,11 +18,11 @@ extern crate crypto;
|
|||
extern crate getopts;
|
||||
|
||||
use std::ascii::AsciiExt;
|
||||
use std::io::fs::File;
|
||||
use std::io::stdio::stdin_raw;
|
||||
use std::io::BufferedReader;
|
||||
use std::io::IoError;
|
||||
use std::io::EndOfFile;
|
||||
use std::old_io::fs::File;
|
||||
use std::old_io::stdio::stdin_raw;
|
||||
use std::old_io::BufferedReader;
|
||||
use std::old_io::IoError;
|
||||
use std::old_io::EndOfFile;
|
||||
use regex::Regex;
|
||||
use crypto::digest::Digest;
|
||||
use crypto::md5::Md5;
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
extern crate getopts;
|
||||
|
||||
use std::char::CharExt;
|
||||
use std::io::{stdin};
|
||||
use std::io::{BufferedReader, BytesReader};
|
||||
use std::io::fs::File;
|
||||
use std::old_io::{stdin};
|
||||
use std::old_io::{BufferedReader, BytesReader};
|
||||
use std::old_io::fs::File;
|
||||
use std::path::Path;
|
||||
use std::str::from_utf8;
|
||||
use getopts::{optopt, optflag, getopts, usage};
|
||||
|
|
|
@ -18,7 +18,7 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::collections::hash_set::HashSet;
|
||||
use std::io::net::addrinfo;
|
||||
use std::old_io::net::addrinfo;
|
||||
use std::iter::repeat;
|
||||
use std::str;
|
||||
use getopts::{optflag, getopts, usage};
|
||||
|
|
|
@ -18,7 +18,7 @@ extern crate serialize;
|
|||
|
||||
#[macro_use] extern crate log;
|
||||
|
||||
use std::io::process::Process;
|
||||
use std::old_io::process::Process;
|
||||
|
||||
use getopts::{
|
||||
getopts,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::fs::link;
|
||||
use std::old_io::fs::link;
|
||||
use std::path::Path;
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
|
|
|
@ -18,7 +18,7 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::ffi::c_str_to_bytes;
|
||||
use std::io::print;
|
||||
use std::old_io::print;
|
||||
use libc::c_char;
|
||||
|
||||
#[path = "../common/util.rs"] #[macro_use] mod util;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::fs::{self, PathExtensions};
|
||||
use std::io::FilePermission;
|
||||
use std::old_io::fs::{self, PathExtensions};
|
||||
use std::old_io::FilePermission;
|
||||
use std::num::from_str_radix;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::{BufferedReader, IoResult, fs};
|
||||
use std::io::stdio::stdin_raw;
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::{BufferedReader, IoResult, fs};
|
||||
use std::old_io::stdio::stdin_raw;
|
||||
use std::old_io::fs::PathExtensions;
|
||||
use std::path::GenericPath;
|
||||
use getopts::{
|
||||
getopts,
|
||||
|
|
|
@ -14,7 +14,7 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::io::IoError;
|
||||
use std::old_io::IoError;
|
||||
use std::os;
|
||||
use libc::{c_char, c_int, execvp};
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
extern crate regex;
|
||||
extern crate getopts;
|
||||
|
||||
use std::io::{stdin};
|
||||
use std::io::BufferedReader;
|
||||
use std::io::fs::File;
|
||||
use std::old_io::{stdin};
|
||||
use std::old_io::BufferedReader;
|
||||
use std::old_io::fs::File;
|
||||
use std::iter::repeat;
|
||||
use std::num::Int;
|
||||
use std::path::Path;
|
||||
|
|
|
@ -15,8 +15,8 @@ extern crate libc;
|
|||
|
||||
use getopts::{optflag, getopts, usage};
|
||||
use std::ffi::CString;
|
||||
use std::io::stdio::{stdin_raw, stdout_raw, stderr_raw};
|
||||
use std::io::{File, Open, Read, Append, Write};
|
||||
use std::old_io::stdio::{stdin_raw, stdout_raw, stderr_raw};
|
||||
use std::old_io::{File, Open, Read, Append, Write};
|
||||
use std::os::unix::prelude::*;
|
||||
use libc::c_char;
|
||||
use libc::funcs::posix88::unistd::{dup2, execvp};
|
||||
|
@ -88,7 +88,7 @@ fn replace_fds() {
|
|||
}
|
||||
};
|
||||
if unsafe { dup2(new_stdin.as_raw_fd(), 0) } != 0 {
|
||||
crash!(2, "Cannot replace STDIN: {}", std::io::IoError::last_error())
|
||||
crash!(2, "Cannot replace STDIN: {}", std::old_io::IoError::last_error())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,13 +97,13 @@ fn replace_fds() {
|
|||
let fd = new_stdout.as_raw_fd();
|
||||
|
||||
if unsafe { dup2(fd, 1) } != 1 {
|
||||
crash!(2, "Cannot replace STDOUT: {}", std::io::IoError::last_error())
|
||||
crash!(2, "Cannot replace STDOUT: {}", std::old_io::IoError::last_error())
|
||||
}
|
||||
}
|
||||
|
||||
if replace_stderr {
|
||||
if unsafe { dup2(1, 2) } != 2 {
|
||||
crash!(2, "Cannot replace STDERR: {}", std::io::IoError::last_error())
|
||||
crash!(2, "Cannot replace STDERR: {}", std::old_io::IoError::last_error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ extern crate getopts;
|
|||
extern crate collections;
|
||||
|
||||
use collections::string::String;
|
||||
use std::io::File;
|
||||
use std::old_io::File;
|
||||
|
||||
#[derive(Show)]
|
||||
enum Radix { Decimal, Hexadecimal, Octal, Binary }
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::old_io as io;
|
||||
use std::iter::repeat;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
|
|
@ -16,7 +16,7 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::os;
|
||||
use std::io::print;
|
||||
use std::old_io::print;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::print;
|
||||
use std::old_io::print;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
extern crate getopts;
|
||||
|
||||
use getopts::{optflag, getopts, usage, OptGroup};
|
||||
use std::io;
|
||||
use std::io::fs;
|
||||
use std::old_io as io;
|
||||
use std::old_io::fs;
|
||||
use std::os;
|
||||
use std::vec::Vec;
|
||||
|
||||
|
|
|
@ -87,12 +87,12 @@ fn resolve_path(path: &str, strip: bool, zero: bool, quiet: bool) -> bool {
|
|||
if !quiet { show_error!("Too many symbolic links: {}", path) };
|
||||
return false
|
||||
}
|
||||
match std::io::fs::lstat(&result) {
|
||||
match std::old_io::fs::lstat(&result) {
|
||||
Err(_) => break,
|
||||
Ok(ref s) if s.kind != std::io::FileType::Symlink => break,
|
||||
Ok(ref s) if s.kind != std::old_io::FileType::Symlink => break,
|
||||
Ok(_) => {
|
||||
links_left -= 1;
|
||||
match std::io::fs::readlink(&result) {
|
||||
match std::old_io::fs::readlink(&result) {
|
||||
Ok(x) => {
|
||||
result.pop();
|
||||
result.push(x);
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::{print, stdin, stdio, fs, BufferedReader};
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::{print, stdin, stdio, fs, BufferedReader};
|
||||
use std::old_io::fs::PathExtensions;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::{print, fs};
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::{print, fs};
|
||||
use std::old_io::fs::PathExtensions;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -14,8 +14,8 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::cmp;
|
||||
use std::io;
|
||||
use std::io::IoResult;
|
||||
use std::old_io as io;
|
||||
use std::old_io::IoResult;
|
||||
use std::iter::{range_inclusive, RangeInclusive};
|
||||
use std::rand::{self, Rng};
|
||||
use std::usize;
|
||||
|
|
|
@ -14,7 +14,7 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::f64;
|
||||
use std::io::{print, timer};
|
||||
use std::old_io::{print, timer};
|
||||
use std::time::duration::{self, Duration};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
extern crate getopts;
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::io::{print, File, BufferedReader};
|
||||
use std::io::stdio::stdin_raw;
|
||||
use std::old_io::{print, File, BufferedReader};
|
||||
use std::old_io::stdio::stdin_raw;
|
||||
use std::str::Chars;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::old_io as io;
|
||||
use std::num::Int;
|
||||
use std::char;
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
use getopts::{optopt, optflag, getopts, usage, Matches, OptGroup};
|
||||
use std::io::process::{Command, StdioContainer, ProcessExit};
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::process::{Command, StdioContainer, ProcessExit};
|
||||
use std::old_io::fs::PathExtensions;
|
||||
use std::iter::range_inclusive;
|
||||
use std::num::Int;
|
||||
use std::os;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::{File, IoResult, print};
|
||||
use std::io::stdio::{stdin_raw};
|
||||
use std::old_io::{File, IoResult, print};
|
||||
use std::old_io::stdio::{stdin_raw};
|
||||
|
||||
#[path="../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::old_io as io;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
extern crate getopts;
|
||||
|
||||
use std::char::CharExt;
|
||||
use std::io::{stdin, stdout};
|
||||
use std::io::{BufferedReader, BytesReader};
|
||||
use std::io::fs::File;
|
||||
use std::old_io::{stdin, stdout};
|
||||
use std::old_io::{BufferedReader, BytesReader};
|
||||
use std::old_io::fs::File;
|
||||
use std::path::Path;
|
||||
use std::str::from_utf8;
|
||||
use getopts::{optopt, optflag, getopts, usage};
|
||||
use std::collections::ring_buf::RingBuf;
|
||||
use std::io::timer::sleep;
|
||||
use std::old_io::timer::sleep;
|
||||
use std::time::duration::Duration;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
extern crate getopts;
|
||||
#[macro_use] extern crate log;
|
||||
|
||||
use std::io::{println, stdin, stdout, Append, File, Truncate, Write};
|
||||
use std::io::{IoResult};
|
||||
use std::io::util::{copy, NullWriter, MultiWriter};
|
||||
use std::old_io::{println, stdin, stdout, Append, File, Truncate, Write};
|
||||
use std::old_io::{IoResult};
|
||||
use std::old_io::util::{copy, NullWriter, MultiWriter};
|
||||
use std::os;
|
||||
use getopts::{getopts, optflag, usage};
|
||||
|
||||
|
@ -109,9 +109,9 @@ struct NamedWriter {
|
|||
}
|
||||
|
||||
impl Writer for NamedWriter {
|
||||
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
with_path(&*self.path.clone(), || {
|
||||
let val = self.inner.write(buf);
|
||||
let val = self.inner.write_all(buf);
|
||||
if val.is_err() {
|
||||
self.inner = Box::new(NullWriter) as Box<Writer>;
|
||||
}
|
||||
|
|
|
@ -382,8 +382,8 @@ fn path(path: &[u8], cond: PathCondition) -> bool {
|
|||
|
||||
#[cfg(windows)]
|
||||
fn path(path: &[u8], cond: PathCondition) -> bool {
|
||||
use std::io::{TypeFile, TypeDirectory, TypeBlockSpecial, TypeNamedPipe};
|
||||
use std::io::fs::{stat};
|
||||
use std::old_io::{TypeFile, TypeDirectory, TypeBlockSpecial, TypeNamedPipe};
|
||||
use std::old_io::fs::{stat};
|
||||
use std::path::{Path};
|
||||
|
||||
let path = match Path::new_opt(path) {
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::{PathDoesntExist, FileNotFound};
|
||||
use std::io::process::{Command, ExitStatus, ExitSignal, InheritFd};
|
||||
use std::old_io::{PathDoesntExist, FileNotFound};
|
||||
use std::old_io::process::{Command, ExitStatus, ExitSignal, InheritFd};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
extern crate getopts;
|
||||
extern crate time;
|
||||
|
||||
use std::io::File;
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::File;
|
||||
use std::old_io::fs::PathExtensions;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
@ -127,7 +127,7 @@ pub fn uumain(args: Vec<String>) -> isize {
|
|||
}
|
||||
}
|
||||
|
||||
match std::io::fs::change_file_times(&path, atime, mtime) {
|
||||
match std::old_io::fs::change_file_times(&path, atime, mtime) {
|
||||
Ok(t) => t,
|
||||
Err(e) => panic!("Unable to modify times\n{}", e.desc)
|
||||
}
|
||||
|
@ -136,14 +136,14 @@ pub fn uumain(args: Vec<String>) -> isize {
|
|||
0
|
||||
}
|
||||
|
||||
fn stat(path: &Path, follow: bool) -> std::io::FileStat {
|
||||
fn stat(path: &Path, follow: bool) -> std::old_io::FileStat {
|
||||
if follow {
|
||||
match std::io::fs::stat(path) {
|
||||
match std::old_io::fs::stat(path) {
|
||||
Ok(stat) => stat,
|
||||
Err(e) => panic!("Unable to open file\n{}", e.desc)
|
||||
}
|
||||
} else {
|
||||
match std::io::fs::lstat(path) {
|
||||
match std::old_io::fs::lstat(path) {
|
||||
Ok(stat) => stat,
|
||||
Err(e) => panic!("Unable to open file\n{}", e.desc)
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ extern crate getopts;
|
|||
use getopts::OptGroup;
|
||||
use std::char::from_u32;
|
||||
use std::collections::{BitvSet, VecMap};
|
||||
use std::io::{BufferedReader, print};
|
||||
use std::io::stdio::{stdin_raw, stdout};
|
||||
use std::old_io::{BufferedReader, print};
|
||||
use std::old_io::stdio::{stdin_raw, stdout};
|
||||
use std::iter::FromIterator;
|
||||
use std::vec::Vec;
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::ascii::AsciiExt;
|
||||
use std::io::{File, Open, ReadWrite, fs};
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::{File, Open, ReadWrite, fs};
|
||||
use std::old_io::fs::PathExtensions;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::old_io as io;
|
||||
use std::collections::{HashSet, HashMap};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
|
|
@ -18,8 +18,8 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::ffi::c_str_to_bytes;
|
||||
use std::io::println;
|
||||
use std::io::stdio::stderr;
|
||||
use std::old_io::println;
|
||||
use std::old_io::stdio::stderr;
|
||||
use getopts::{optflag,getopts};
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
|
|
@ -19,7 +19,7 @@ extern crate libc;
|
|||
|
||||
use std::ffi::c_str_to_bytes;
|
||||
use std::mem::uninitialized;
|
||||
use std::io::print;
|
||||
use std::old_io::print;
|
||||
use c_types::utsname;
|
||||
|
||||
#[path = "../common/util.rs"] #[macro_use] mod util;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::old_io as io;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -16,7 +16,7 @@ extern crate getopts;
|
|||
use std::ascii::OwnedAsciiExt;
|
||||
use std::cmp::min;
|
||||
use std::str::FromStr;
|
||||
use std::io;
|
||||
use std::old_io as io;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io;
|
||||
use std::io::fs::{self, PathExtensions};
|
||||
use std::io::print;
|
||||
use std::old_io as io;
|
||||
use std::old_io::fs::{self, PathExtensions};
|
||||
use std::old_io::print;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
|
|
|
@ -20,7 +20,7 @@ extern crate "time" as rtime;
|
|||
|
||||
use std::ffi::CString;
|
||||
use std::mem::transmute;
|
||||
use std::io::{print, File};
|
||||
use std::old_io::{print, File};
|
||||
use std::ptr::null;
|
||||
use libc::{time_t, c_double, c_int, c_char};
|
||||
use utmpx::*;
|
||||
|
|
|
@ -19,7 +19,7 @@ extern crate getopts;
|
|||
extern crate libc;
|
||||
|
||||
use std::ffi::{CString, c_str_to_bytes};
|
||||
use std::io::print;
|
||||
use std::old_io::print;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use utmpx::*;
|
||||
|
|
|
@ -15,9 +15,9 @@ extern crate libc;
|
|||
|
||||
use std::ascii::AsciiExt;
|
||||
use std::str::from_utf8;
|
||||
use std::io::{print, File, BufferedReader};
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::io::stdio::stdin_raw;
|
||||
use std::old_io::{print, File, BufferedReader};
|
||||
use std::old_io::fs::PathExtensions;
|
||||
use std::old_io::stdio::stdin_raw;
|
||||
use std::result::Result as StdResult;
|
||||
use std::borrow::IntoCow;
|
||||
use getopts::Matches;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::print;
|
||||
use std::old_io::print;
|
||||
|
||||
#[path = "../common/util.rs"] #[macro_use] mod util;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
use std::io::print;
|
||||
use std::old_io::print;
|
||||
use std::borrow::IntoCow;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::process::Command;
|
||||
use std::old_io::process::Command;
|
||||
use std::str;
|
||||
|
||||
static PROGNAME: &'static str = "./cat";
|
||||
|
@ -26,7 +26,7 @@ fn test_output_multi_files_print_all_chars() {
|
|||
fn test_stdin_squeeze() {
|
||||
let mut process= Command::new(PROGNAME).arg("-A").spawn().unwrap();
|
||||
|
||||
process.stdin.take().unwrap().write(b"\x00\x01\x02").unwrap();
|
||||
process.stdin.take().unwrap().write_all(b"\x00\x01\x02").unwrap();
|
||||
let po = process.wait_with_output().unwrap();
|
||||
let out = str::from_utf8(po.output.as_slice()).unwrap();
|
||||
|
||||
|
@ -37,7 +37,7 @@ fn test_stdin_squeeze() {
|
|||
fn test_stdin_number_non_blank() {
|
||||
let mut process = Command::new(PROGNAME).arg("-b").arg("-").spawn().unwrap();
|
||||
|
||||
process.stdin.take().unwrap().write(b"\na\nb\n\n\nc").unwrap();
|
||||
process.stdin.take().unwrap().write_all(b"\na\nb\n\n\nc").unwrap();
|
||||
let po = process.wait_with_output().unwrap();
|
||||
let out = str::from_utf8(po.output.as_slice()).unwrap();
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::process::Command;
|
||||
use std::io::File;
|
||||
use std::io::fs::{unlink, PathExtensions};
|
||||
use std::old_io::process::Command;
|
||||
use std::old_io::File;
|
||||
use std::old_io::fs::{unlink, PathExtensions};
|
||||
|
||||
static EXE: &'static str = "./cp";
|
||||
static TEST_HELLO_WORLD_SOURCE: &'static str = "hello_world.txt";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::process::Command;
|
||||
use std::io::fs::{rmdir, PathExtensions};
|
||||
use std::old_io::process::Command;
|
||||
use std::old_io::fs::{rmdir, PathExtensions};
|
||||
use std::borrow::ToOwned;
|
||||
|
||||
static EXE: &'static str = "./mkdir";
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
extern crate time;
|
||||
|
||||
use std::io::{process, fs, FilePermission};
|
||||
use std::io::process::Command;
|
||||
use std::io::fs::PathExtensions;
|
||||
use std::old_io::{process, fs, FilePermission};
|
||||
use std::old_io::process::Command;
|
||||
use std::old_io::fs::PathExtensions;
|
||||
use std::str::from_utf8;
|
||||
use std::borrow::ToOwned;
|
||||
|
||||
|
@ -35,7 +35,7 @@ fn run_interactive(cmd: &mut Command, input: &[u8])-> CmdResult {
|
|||
let stdin_cfg = process::CreatePipe(true, false);
|
||||
let mut command = cmd.stdin(stdin_cfg).spawn().unwrap();
|
||||
|
||||
command.stdin.as_mut().unwrap().write(input);
|
||||
command.stdin.as_mut().unwrap().write_all(input);
|
||||
|
||||
let prog = command.wait_with_output().unwrap();
|
||||
CmdResult {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::process::Command;
|
||||
use std::old_io::process::Command;
|
||||
use std::str;
|
||||
|
||||
static PROGNAME: &'static str = "./nl";
|
||||
|
@ -8,7 +8,7 @@ static PROGNAME: &'static str = "./nl";
|
|||
#[test]
|
||||
fn test_stdin_nonewline() {
|
||||
let mut process = Command::new(PROGNAME).spawn().unwrap();
|
||||
process.stdin.take().unwrap().write(b"No Newline").unwrap();
|
||||
process.stdin.take().unwrap().write_all(b"No Newline").unwrap();
|
||||
let po = process.wait_with_output().unwrap();
|
||||
let out = str::from_utf8(po.output.as_slice()).unwrap();
|
||||
|
||||
|
@ -19,7 +19,7 @@ fn test_stdin_newline() {
|
|||
let mut process = Command::new(PROGNAME).arg("-s").arg("-")
|
||||
.arg("-w").arg("1").spawn().unwrap();
|
||||
|
||||
process.stdin.take().unwrap().write(b"Line One\nLine Two\n").unwrap();
|
||||
process.stdin.take().unwrap().write_all(b"Line One\nLine Two\n").unwrap();
|
||||
let po = process.wait_with_output().unwrap();
|
||||
let out = str::from_utf8(po.output.as_slice()).unwrap();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::process::Command;
|
||||
use std::old_io::process::Command;
|
||||
use std::str;
|
||||
|
||||
static PROGNAME: &'static str = "./seq";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::process::Command;
|
||||
use std::io::File;
|
||||
use std::old_io::process::Command;
|
||||
use std::old_io::File;
|
||||
use std::string::String;
|
||||
|
||||
static PROGNAME: &'static str = "./sort";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::process::Command;
|
||||
use std::old_io::process::Command;
|
||||
|
||||
static EXE: &'static str = "./test";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::process::Command;
|
||||
use std::old_io::process::Command;
|
||||
|
||||
static PROGNAME: &'static str = "./tr";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io;
|
||||
use std::io::process::Command;
|
||||
use std::old_io as io;
|
||||
use std::old_io::process::Command;
|
||||
|
||||
static PROGNAME: &'static str = "./truncate";
|
||||
static TFILE1: &'static str = "truncate_test_1";
|
||||
|
@ -30,7 +30,7 @@ fn test_increase_file_size() {
|
|||
#[test]
|
||||
fn test_decrease_file_size() {
|
||||
let mut file = make_file(TFILE2);
|
||||
file.write(b"1234567890").unwrap();
|
||||
file.write_all(b"1234567890").unwrap();
|
||||
if !Command::new(PROGNAME).args(&["--size=-4", TFILE2]).status().unwrap().success() {
|
||||
panic!();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(unstable)]
|
||||
|
||||
use std::io::process::Command;
|
||||
use std::old_io::process::Command;
|
||||
|
||||
static PROGNAME: &'static str = "./unexpand";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue