diff options
Diffstat (limited to 'src/macros.rs')
-rw-r--r-- | src/macros.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/macros.rs b/src/macros.rs new file mode 100644 index 00000000..7c85f3c7 --- /dev/null +++ b/src/macros.rs @@ -0,0 +1,16 @@ +#[macro_export] +macro_rules! die { + ($($arg:tt)*) => { + println!($($arg)*); + ::std::process::exit(1); + } +} + +#[macro_export] +macro_rules! err_println { + ($($arg:tt)*) => { + if let Err(_) = writeln!(&mut ::std::io::stderr(), $($arg)*) { + die!("Cannot reach stderr"); + } + } +} |