no-more-secrets-rust/src/lib.rs

36 lines
656 B
Rust
Raw Normal View History

2023-07-23 03:04:59 -07:00
mod args;
2023-07-23 03:03:23 -07:00
2023-07-23 03:14:49 -07:00
use libc::{c_int, c_void};
2023-07-23 03:14:38 -07:00
2023-07-23 03:19:40 -07:00
const VERSION: &str = "2.0.0";
2023-07-23 03:14:49 -07:00
extern "C" {
fn nmseffect_set_autodecrypt(_: c_int) -> c_void;
2023-07-23 03:19:40 -07:00
fn nmseffect_set_clearscr(_: c_int) -> c_void;
2023-07-23 03:14:38 -07:00
}
2023-07-23 03:03:23 -07:00
#[no_mangle]
pub extern "C" fn rust_main() {
println!("Hello from rust");
2023-07-23 03:14:38 -07:00
let args = args::parse_arguments().unwrap();
2023-07-23 03:19:40 -07:00
if args.version {
println!("nms version {VERSION}");
std::process::exit(0);
}
if args.clear_screen {
unsafe {
nmseffect_set_clearscr(1);
}
}
2023-07-23 03:14:38 -07:00
if args.autodecrypt {
unsafe {
nmseffect_set_autodecrypt(1);
}
}
println!("{:?}", args);
2023-07-23 03:03:23 -07:00
}