diff --git a/Makefile b/Makefile index 8c22903..d5203f5 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ build/o/libstrerror.rlib: build src/strerror.rs $(RUSTC) $(RUSTFLAGS) --crate-type=lib -o $@ \ src/strerror.rs -build/o/libsysexits.rlib: build +build/o/libsysexits.rlib: build include/sysexits.h # bandage solution until bindgen(1) gets stdin support printf '#define EXIT_FAILURE 1\n' | cat - include/sysexits.h \ > build/include/sysexits.h diff --git a/src/fop.rs b/src/fop.rs index 0e0b059..65ee738 100644 --- a/src/fop.rs +++ b/src/fop.rs @@ -27,7 +27,7 @@ extern crate strerror; extern crate sysexits; use getopt::{ Opt, Parser }; -use strerror::c_error; +use strerror::raw_message; use sysexits::{ EX_DATAERR, EX_IOERR, EX_UNAVAILABLE, EX_USAGE }; fn main() { @@ -77,7 +77,7 @@ fn main() { .stdout(Stdio::piped()) .spawn() .unwrap_or_else( |e| { - eprintln!("{}: {}: {}", argv[0], argv[command_arg], c_error(e)); + eprintln!("{}: {}: {}", argv[0], argv[command_arg], raw_message(e)); exit(EX_UNAVAILABLE); }); @@ -96,7 +96,7 @@ fn main() { } let output = spawned.wait_with_output().unwrap_or_else(|e| { - eprintln!("{}: {}: {}", argv[0], argv[command_arg], c_error(e)); + eprintln!("{}: {}: {}", argv[0], argv[command_arg], raw_message(e)); exit(EX_IOERR); }); @@ -114,7 +114,7 @@ fn main() { stdout().write_all( fields.join(&d.to_string()).as_bytes() ).unwrap_or_else(|e| { - eprintln!("{}: {}", argv[0], c_error(e)); + eprintln!("{}: {}", argv[0], raw_message(e)); exit(EX_IOERR); }); } diff --git a/src/hru.rs b/src/hru.rs index ad73070..29e1e49 100644 --- a/src/hru.rs +++ b/src/hru.rs @@ -26,7 +26,7 @@ use std::{ extern crate strerror; extern crate sysexits; -use strerror::c_error; +use strerror::raw_message; use sysexits::{ EX_DATAERR, EX_IOERR, EX_SOFTWARE }; const LIST: [(u32, &str); 10] = [ @@ -100,7 +100,7 @@ fn main() -> ExitCode { stdout().write_all(format!("{} {}\n", out, si_prefix).as_bytes()) .unwrap_or_else(|e| { - eprintln!("{}: {}", argv[0], c_error(e)); + eprintln!("{}: {}", argv[0], raw_message(e)); exit(EX_IOERR); }); } diff --git a/src/strerror.rs b/src/strerror.rs index 0939df9..117ed0b 100644 --- a/src/strerror.rs +++ b/src/strerror.rs @@ -13,7 +13,7 @@ use std::ffi::{ c_int, c_char, CStr }; extern "C" { fn strerror(errnum: c_int) -> *mut c_char; } /* wrapper function for use in Rust */ -pub fn c_error(err: std::io::Error) -> String { +pub fn raw_message(err: std::io::Error) -> String { /* Get the raw OS error. If it’s None, what the hell is going on‽ */ let error = err.raw_os_error().unwrap_or_else(|| { panic!() }) as c_int;