diff --git a/src/lib.rs b/src/lib.rs index 86a654c..be1dac2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,8 +2,11 @@ mod args; use libc::{c_int, c_void}; +const VERSION: &str = "2.0.0"; + extern "C" { fn nmseffect_set_autodecrypt(_: c_int) -> c_void; + fn nmseffect_set_clearscr(_: c_int) -> c_void; } #[no_mangle] @@ -12,6 +15,17 @@ pub extern "C" fn rust_main() { let args = args::parse_arguments().unwrap(); + if args.version { + println!("nms version {VERSION}"); + std::process::exit(0); + } + + if args.clear_screen { + unsafe { + nmseffect_set_clearscr(1); + } + } + if args.autodecrypt { unsafe { nmseffect_set_autodecrypt(1); diff --git a/src/nms.c b/src/nms.c index 5f9e2ce..2103200 100644 --- a/src/nms.c +++ b/src/nms.c @@ -35,12 +35,6 @@ int main(int argc, char *argv[]) case 's': nmseffect_set_maskblank(1); break; - case 'c': - nmseffect_set_clearscr(1); - break; - case 'v': - printf("nms version " VERSION "\n"); - return EXIT_SUCCESS; case '?': if (isprint(optopt)) {