Add the last few things for bash to compile :D

This commit is contained in:
jD91mZM2
2018-08-03 11:18:52 +02:00
parent 44599a032e
commit ba8bd8c4e8
12 changed files with 112 additions and 26 deletions
+2 -1
View File
@@ -8,5 +8,6 @@ build = "build.rs"
cbindgen = { path = "../../cbindgen" }
[dependencies]
platform = { path = "../platform" }
errno = { path = "../errno" }
platform = { path = "../platform" }
signal = { path = "../signal" }
+8
View File
@@ -3,6 +3,7 @@
extern crate errno;
extern crate platform;
extern crate signal;
use core::cmp;
use core::mem;
@@ -308,6 +309,13 @@ pub unsafe extern "C" fn strrchr(s: *const c_char, c: c_int) -> *mut c_char {
ptr::null_mut()
}
#[no_mangle]
pub unsafe extern "C" fn strsignal(sig: c_int) -> *mut c_char {
// Mutating this is undefined behavior I believe. But I just can't create a
// &'static mut str. Alternative is allocating everything on the heap...
signal::_signal_strings[sig as usize].as_ptr() as *const c_char as *mut c_char
}
#[no_mangle]
pub unsafe extern "C" fn strspn(s1: *const c_char, s2: *const c_char) -> size_t {
let s1 = s1 as *const u8;