use std::env;
use std::ffi::OsStr;
use std::path::Path;
use std::process::ExitCode;
const PROGRAM: &str = env!("CARGO_PKG_NAME");
const VERSION: &str = env!("CARGO_PKG_VERSION");
const AUTHORS: &str = env!("CARGO_PKG_AUTHORS");
fn main() -> ExitCode {
eprintln!("{PROGRAM} {VERSION} - Tool to extract strings and related pseudocode");
eprintln!("Copyright (c) 2024-2026 {AUTHORS}");
eprintln!();
idalib::force_batch_mode();
let mut args = env::args_os();
let argv0 = args.next().unwrap_or_else(|| PROGRAM.into());
let is_help = |a: &OsStr| a == OsStr::new("-h") || a == OsStr::new("--help");
let prog = Path::new(&argv0)
.file_name()
.and_then(|s| s.to_str())
.unwrap_or(PROGRAM);
let filename = match (args.next(), args.next()) {
(Some(arg), None) if !is_help(&arg) => arg,
_ => return usage(prog),
};
match augur::run(Path::new(&filename)) {
Ok(_) => ExitCode::SUCCESS,
Err(err) => {
eprintln!("[!] Error: {err:#}");
ExitCode::FAILURE
}
}
}
fn usage(prog: &str) -> ExitCode {
eprintln!("Usage:");
eprintln!("{prog} <binary_file>");
ExitCode::FAILURE
}