aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cocoa_bridge.rs13
-rw-r--r--src/config.rs2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs
index 529fb5d..2ef4979 100644
--- a/src/cocoa_bridge.rs
+++ b/src/cocoa_bridge.rs
@@ -299,8 +299,8 @@ fn run_action(map_action: &MapAction) {
// }
#[no_mangle]
-pub extern "C" fn parse_args(
- args: *const c_char,
+pub extern "C" fn c_parse_args(
+ args: *const *const c_char,
length: size_t,
) -> *const Config {
let args = unsafe {
@@ -310,10 +310,13 @@ pub extern "C" fn parse_args(
args
.iter()
- .map(|s|
- CStr::from_ptr(s)
+ .map(|s| {
+ assert!(!s.is_null());
+
+ CStr::from_ptr(*s)
.to_string_lossy()
- .into_owned())
+ .into_owned()
+ })
.collect::<Vec<String>>()
};
diff --git a/src/config.rs b/src/config.rs
index b7b09ab..6ee2d17 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -25,7 +25,7 @@ pub fn parse_args(args: &[String]) -> Config {
opts.optflag("r", "reload-mappings", "reload the mappings file");
opts.optflag("h", "help", "print this help menu");
- let matches = match opts.parse(args) {
+ let matches = match opts.parse(&args[1..]) {
Ok(m) => m,
Err(e) => panic!(e),
};