1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-31 21:17:46 +00:00

Merge pull request #476 from lht/fix-build-master

Fix build master
This commit is contained in:
Alex Lyon 2014-12-21 19:53:29 -08:00
commit 06ee630023
16 changed files with 52 additions and 42 deletions

View file

@ -223,7 +223,7 @@ $(BUILDDIR)/uutils: $(SRCDIR)/uutils/uutils.rs $(BUILDDIR)/mkuutils $(RLIB_PATHS
# Dependencies
-include $(BUILDDIR)/rust-crypto.d
$(BUILDDIR)/.rust-crypto: $(BUILDDIR)/.rust-time | $(BUILDDIR)
$(RUSTC) $(RUSTCFLAGS) --extern time=$(BUILDDIR)/libtime.rlib --crate-type rlib --dep-info $(BUILDDIR)/rust-crypto.d $(BASEDIR)/deps/rust-crypto/src/rust-crypto/lib.rs --out-dir $(BUILDDIR)/
$(RUSTC) $(RUSTCFLAGS) --extern time=$(BUILDDIR)/libtime.rlib --crate-type rlib --crate-name crypto --dep-info $(BUILDDIR)/rust-crypto.d $(BASEDIR)/deps/rust-crypto/src/rust-crypto/lib.rs --out-dir $(BUILDDIR)/
@touch $@
$(BUILDDIR)/.rust-time:

2
deps/rust-crypto vendored

@ -1 +1 @@
Subproject commit b463ff97f78ea06ce9bcf0f1fafe63e5966f2499
Subproject commit baa0874a75fcb76eeb6a7e430f02aaaf4e4b2701

View file

@ -205,9 +205,9 @@ fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool
};
for mode in cmode.unwrap().as_slice().split(',') { // cmode is guaranteed to be Some in this case
let cap = REGEXP.captures(mode).unwrap(); // mode was verified earlier, so this is safe
if cap.at(1) != "" {
if cap.at(1).unwrap() != "" {
// symbolic
let mut levels = cap.at(2);
let mut levels = cap.at(2).unwrap();
if levels.len() == 0 {
levels = "a";
}
@ -272,7 +272,7 @@ fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool
}
} else {
// numeric
let change = cap.at(4);
let change = cap.at(4).unwrap();
let ch = change.char_at(0);
let (action, slice) = match ch {
'+' | '-' | '=' => (ch, change.slice_from(1)),

View file

@ -17,7 +17,7 @@ macro_rules! show_error(
pipe_write!(&mut ::std::io::stderr(), "{}: error: ", ::NAME);
pipe_writeln!(&mut ::std::io::stderr(), $($args),+);
})
)
);
#[macro_export]
macro_rules! show_warning(
@ -25,7 +25,7 @@ macro_rules! show_warning(
pipe_write!(&mut ::std::io::stderr(), "{}: warning: ", ::NAME);
pipe_writeln!(&mut ::std::io::stderr(), $($args),+);
})
)
);
#[macro_export]
macro_rules! show_info(
@ -33,17 +33,17 @@ macro_rules! show_info(
pipe_write!(&mut ::std::io::stderr(), "{}: ", ::NAME);
pipe_writeln!(&mut ::std::io::stderr(), $($args),+);
})
)
);
#[macro_export]
macro_rules! eprint(
($($args:expr),+) => (pipe_write!(&mut ::std::io::stderr(), $($args),+))
)
);
#[macro_export]
macro_rules! eprintln(
($($args:expr),+) => (pipe_writeln!(&mut ::std::io::stderr(), $($args),+))
)
);
#[macro_export]
macro_rules! crash(
@ -51,14 +51,14 @@ macro_rules! crash(
show_error!($($args),+);
unsafe { ::util::libc::exit($exitcode as ::util::libc::c_int); }
})
)
);
#[macro_export]
macro_rules! exit(
($exitcode:expr) => ({
unsafe { ::util::libc::exit($exitcode); }
})
)
);
#[macro_export]
macro_rules! crash_if_err(
@ -68,7 +68,7 @@ macro_rules! crash_if_err(
Err(f) => crash!($exitcode, "{}", f.to_string())
}
)
)
);
#[macro_export]
macro_rules! return_if_err(
@ -81,7 +81,7 @@ macro_rules! return_if_err(
}
}
)
)
);
// XXX: should the pipe_* macros return an Err just to show the write failed?
@ -99,7 +99,7 @@ macro_rules! pipe_print(
}
}
)
)
);
#[macro_export]
macro_rules! pipe_println(
@ -115,7 +115,7 @@ macro_rules! pipe_println(
}
}
)
)
);
#[macro_export]
macro_rules! pipe_write(
@ -131,7 +131,7 @@ macro_rules! pipe_write(
}
}
)
)
);
#[macro_export]
macro_rules! pipe_writeln(
@ -147,7 +147,7 @@ macro_rules! pipe_writeln(
}
}
)
)
);
#[macro_export]
macro_rules! safe_write(
@ -157,7 +157,7 @@ macro_rules! safe_write(
Err(f) => panic!(f.to_string())
}
)
)
);
#[macro_export]
macro_rules! safe_writeln(
@ -167,7 +167,7 @@ macro_rules! safe_writeln(
Err(f) => panic!(f.to_string())
}
)
)
);
#[macro_export]
macro_rules! safe_unwrap(
@ -177,4 +177,4 @@ macro_rules! safe_unwrap(
Err(f) => crash!(1, "{}", f.to_string())
}
)
)
);

View file

@ -463,7 +463,7 @@ pub fn uumain(args: Vec<String>) -> int {
let matches = match getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
show_error!("Invalid options\n{}", f)
show_error!("Invalid options\n{}", f);
return 1;
}
};

View file

@ -27,7 +27,7 @@ macro_rules! silent_unwrap(
Err(_) => unsafe { ::util::libc::exit(1) }
}
)
)
);
#[path = "../common/util.rs"]
mod util;
mod linebreak;

View file

@ -72,7 +72,7 @@ pub struct FileLines<'a> {
}
impl<'a> FileLines<'a> {
fn new<'a>(opts: &'a FmtOptions, lines: Lines<'a, FileOrStdReader>) -> FileLines<'a> {
fn new<'b>(opts: &'b FmtOptions, lines: Lines<'b, FileOrStdReader>) -> FileLines<'b> {
FileLines { opts: opts, lines: lines }
}
@ -216,7 +216,7 @@ pub struct ParagraphStream<'a> {
}
impl<'a> ParagraphStream<'a> {
pub fn new<'a>(opts: &'a FmtOptions, reader: &'a mut FileOrStdReader) -> ParagraphStream<'a> {
pub fn new<'b>(opts: &'b FmtOptions, reader: &'b mut FileOrStdReader) -> ParagraphStream<'b> {
let lines = FileLines::new(opts, reader.lines()).peekable();
// at the beginning of the file, we might find mail headers
ParagraphStream { lines: lines, next_mail: true, opts: opts }
@ -399,7 +399,7 @@ pub struct ParaWords<'a> {
}
impl<'a> ParaWords<'a> {
pub fn new<'a>(opts: &'a FmtOptions, para: &'a Paragraph) -> ParaWords<'a> {
pub fn new<'b>(opts: &'b FmtOptions, para: &'b Paragraph) -> ParaWords<'b> {
let mut pw = ParaWords { opts: opts, para: para, words: Vec::new() };
pw.create_words();
pw
@ -478,7 +478,7 @@ impl<'a> WordSplit<'a> {
}
impl<'a> WordSplit<'a> {
fn new<'a>(opts: &'a FmtOptions, string: &'a str) -> WordSplit<'a> {
fn new<'b>(opts: &'b FmtOptions, string: &'b str) -> WordSplit<'b> {
// wordsplits *must* start at a non-whitespace character
let trim_string = string.trim_left();
WordSplit { opts: opts, string: trim_string, length: string.len(), position: 0, prev_punct: false }

View file

@ -15,7 +15,7 @@
extern crate regex;
extern crate "rust-crypto" as crypto;
extern crate crypto;
extern crate getopts;
use std::io::fs::File;
@ -213,9 +213,13 @@ fn hashsum(algoname: &str, mut digest: Box<Digest>, files: Vec<String>, binary:
for (i, line) in buffer.lines().enumerate() {
let line = safe_unwrap!(line);
let (ck_filename, sum, binary_check): (_, Vec<Ascii>, _) = match gnu_re.captures(line.as_slice()) {
Some(caps) => (caps.name("fileName"), caps.name("digest").to_ascii().iter().map(|ch| ch.to_lowercase()).collect(), caps.name("binary") == "*"),
Some(caps) => (caps.name("fileName").unwrap(),
caps.name("digest").unwrap().to_ascii().iter().map(|ch| ch.to_lowercase()).collect(),
caps.name("binary").unwrap() == "*"),
None => match bsd_re.captures(line.as_slice()) {
Some(caps) => (caps.name("fileName"), caps.name("digest").to_ascii().iter().map(|ch| ch.to_lowercase()).collect(), true),
Some(caps) => (caps.name("fileName").unwrap(),
caps.name("digest").unwrap().to_ascii().iter().map(|ch| ch.to_lowercase()).collect(),
true),
None => {
bad_format += 1;
if strict {
@ -228,7 +232,8 @@ fn hashsum(algoname: &str, mut digest: Box<Digest>, files: Vec<String>, binary:
}
}
};
let real_sum: Vec<Ascii> = safe_unwrap!(digest_reader(&mut digest, &mut safe_unwrap!(File::open(&Path::new(ck_filename))), binary_check))
let mut ckf = safe_unwrap!(File::open(&Path::new(ck_filename)));
let real_sum: Vec<Ascii> = safe_unwrap!(digest_reader(&mut digest, &mut ckf, binary_check))
.as_slice().to_ascii().iter().map(|ch| ch.to_lowercase()).collect();
if sum.as_slice() == real_sum.as_slice() {
if !quiet {

View file

@ -146,7 +146,7 @@ fn table() {
fn print_signal(signal_name_or_value: &str) {
for signal in ALL_SIGNALS.iter() {
if signal.name == signal_name_or_value || (format!("SIG{}", signal.name).as_slice()) == signal_name_or_value {
println!("{}", signal.value)
println!("{}", signal.value);
exit!(EXIT_OK as i32)
} else if signal_name_or_value == signal.value.to_string().as_slice() {
println!("{}", signal.name);

View file

@ -62,7 +62,8 @@ fn paste(filenames: Vec<String>, serial: bool, delimiters: &str) {
if name.as_slice() == "-" {
box io::stdio::stdin_raw() as Box<Reader>
} else {
box crash_if_err!(1, io::File::open(&Path::new(name))) as Box<Reader>
let r = crash_if_err!(1, io::File::open(&Path::new(name)));
box r as Box<Reader>
}
)
).collect();

View file

@ -221,10 +221,11 @@ fn split(settings: &Settings) -> int {
if settings.input.as_slice() == "-" {
box io::stdio::stdin_raw() as Box<Reader>
} else {
box match io::File::open(&Path::new(settings.input.clone())) {
let r = match io::File::open(&Path::new(settings.input.clone())) {
Ok(a) => a,
Err(_) => crash!(1, "cannot open '{}' for reading: No such file or directory", settings.input)
} as Box<Reader>
};
box r as Box<Reader>
}
);

View file

@ -75,7 +75,8 @@ fn tac(filenames: Vec<String>, before: bool, _: bool, separator: &str) {
if filename.as_slice() == "-" {
box io::stdio::stdin_raw() as Box<Reader>
} else {
box crash_if_err!(1, io::File::open(&Path::new(filename))) as Box<Reader>
let r = crash_if_err!(1, io::File::open(&Path::new(filename)));
box r as Box<Reader>
}
);
let mut data = crash_if_err!(1, file.read_to_string());

View file

@ -266,7 +266,7 @@ macro_rules! tail_impl (
$kindprint(&mut stdout, datum);
}
})
)
);
fn tail<T: Reader>(reader: &mut BufferedReader<T>, mut line_count: uint, mut byte_count: uint, beginning: bool, lines: bool, follow: bool, sleep_msec: u64) {
if lines {

View file

@ -196,7 +196,8 @@ fn open_input_file(in_file_name: String) -> io::BufferedReader<Box<Reader+'stati
} else {
let path = Path::new(in_file_name);
let in_file = io::File::open(&path);
box crash_if_err!(1, in_file) as Box<Reader>
let r = crash_if_err!(1, in_file);
box r as Box<Reader>
};
io::BufferedReader::new(in_file)
}
@ -207,7 +208,8 @@ fn open_output_file(out_file_name: String) -> io::BufferedWriter<Box<Writer+'sta
} else {
let path = Path::new(out_file_name);
let in_file = io::File::create(&path);
box crash_if_err!(1, in_file) as Box<Writer>
let w = crash_if_err!(1, in_file);
box w as Box<Writer>
};
io::BufferedWriter::new(out_file)
}

View file

@ -97,7 +97,7 @@ fn print_loadavg() {
print!("\n");
}
else {
print!("load average: ")
print!("load average: ");
for n in range(0, loads) {
print!("{:.2}{}", avg[n as uint], if n == loads - 1 { "\n" }
else { ", " } );

View file

@ -17,7 +17,7 @@ macro_rules! assert_empty_stderr(
panic!(format!("stderr: {}", $cond.stderr))
}
);
)
);
struct CmdResult {
success: bool,
stderr: String,
@ -388,7 +388,7 @@ fn test_mv_backup_dir() {
assert_empty_stderr!(result);
assert_eq!(result.stdout.as_slice(),
format!("{} -> {} (backup: {}~)\n", dir_a, dir_b, dir_b).as_slice())
format!("{} -> {} (backup: {}~)\n", dir_a, dir_b, dir_b).as_slice());
assert!(result.success);
assert!(!Path::new(dir_a).is_dir());