Actually run most main()

This commit is contained in:
greg 2019-12-06 02:27:03 -08:00
parent c8153a3122
commit b28b997d20

View File

@ -1,9 +1,27 @@
extern crate libc;
#[allow(non_camel_case_types, non_snake_case, dead_code)] #[allow(non_camel_case_types, non_snake_case, dead_code)]
mod ffi; //generated with `bindgen vendor/most-5.1.0/src/most.h -o src/ffi.rs` mod ffi; //generated with `bindgen vendor/most-5.1.0/src/most.h -o src/ffi.rs`
use std::ffi::CString;
use libc::{c_int, c_char};
fn main() { fn main() {
println!("Printing most usage:");
let args = std::env::args()
.map(|arg| CString::new(arg).unwrap());
let mut c_args: Vec<*mut c_char> = args.map(|arg| arg.into_raw()).collect();
let output = unsafe {
ffi::most_initialize_most();
ffi::most(c_args.len() as c_int, c_args.as_mut_ptr())
};
println!("Output: {}", output);
/*
unsafe { unsafe {
ffi::most_usage(); ffi::most_usage();
} }
*/
} }