Actually run most main()
This commit is contained in:
parent
c8153a3122
commit
b28b997d20
20
src/main.rs
20
src/main.rs
@ -1,9 +1,27 @@
|
||||
extern crate libc;
|
||||
|
||||
#[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`
|
||||
|
||||
use std::ffi::CString;
|
||||
use libc::{c_int, c_char};
|
||||
|
||||
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 {
|
||||
ffi::most_usage();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user