28 lines
592 B
Rust
28 lines
592 B
Rust
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() {
|
|
|
|
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();
|
|
}
|
|
*/
|
|
}
|