diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..aad963b --- /dev/null +++ b/src/error.rs @@ -0,0 +1,10 @@ +macro_rules! print_error { + ($($arg:tt)*) => (eprintln!("[fd error]: {}", format!($($arg)*))) +} + +macro_rules! print_error_and_exit { + ($($arg:tt)*) => { + print_error!($($arg)*); + ::std::process::exit(1); + }; +} diff --git a/src/internal/mod.rs b/src/internal/mod.rs index 90c421a..d6b8026 100644 --- a/src/internal/mod.rs +++ b/src/internal/mod.rs @@ -4,17 +4,6 @@ use std::ffi::{OsStr, OsString}; use regex_syntax::hir::Hir; use regex_syntax::ParserBuilder; -macro_rules! print_error { - ($($arg:tt)*) => (eprintln!("[fd error]: {}", format!($($arg)*))) -} - -macro_rules! print_error_and_exit { - ($($arg:tt)*) => { - print_error!($($arg)*); - ::std::process::exit(1); - }; -} - #[cfg(any(unix, target_os = "redox"))] pub fn osstr_to_bytes(input: &OsStr) -> Cow<[u8]> { use std::os::unix::ffi::OsStrExt; diff --git a/src/main.rs b/src/main.rs index 2d97180..95fd0a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ #[macro_use] -mod internal; +mod error; mod app; mod exec; @@ -7,6 +7,7 @@ mod exit_codes; mod filetypes; mod filter; mod fshelper; +mod internal; mod options; mod output; mod walk;