Fix stdlib div functions, add _Exit

This commit is contained in:
Jeremy Soller
2018-12-14 13:41:22 -07:00
parent 89832b3ac8
commit a8f3608f3c
6 changed files with 36 additions and 1 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ sys_includes = ["stddef.h", "alloca.h"]
include_guard = "_STDLIB_H"
trailer = "#include <bits/stdlib.h>"
language = "C"
style = "Tag"
style = "Type"
[enum]
prefix_with_name = true
+10
View File
@@ -33,6 +33,11 @@ pub const MB_LEN_MAX: c_int = 4;
static mut ATEXIT_FUNCS: [Option<extern "C" fn()>; 32] = [None; 32];
static mut RNG: Option<XorShiftRng> = None;
#[no_mangle]
pub extern "C" fn _Exit(status: c_int) {
unistd::_exit(status);
}
#[no_mangle]
pub unsafe extern "C" fn a64l(s: *const c_char) -> c_long {
if s.is_null() {
@@ -144,6 +149,11 @@ pub extern "C" fn atol(s: *const c_char) -> c_long {
dec_num_from_ascii!(s, c_long)
}
#[no_mangle]
pub extern "C" fn atoll(s: *const c_char) -> c_longlong {
dec_num_from_ascii!(s, c_longlong)
}
unsafe extern "C" fn void_cmp(a: *const c_void, b: *const c_void) -> c_int {
*(a as *const i32) - *(b as *const i32) as c_int
}