This commit is contained in:
nora 2023-09-30 23:52:08 +02:00
parent 9bfadd77d9
commit 84e6db0684
8 changed files with 252 additions and 13 deletions

View file

@ -5,3 +5,8 @@ pub extern "C" fn __stack_chk_fail() -> ! {
libuwuc::start::abort();
}
}
#[no_mangle]
pub extern "C" fn __errno_location() -> *const i32 {
libuwuc::error::errno_location()
}

View file

@ -1,3 +1,5 @@
use core::ffi::{c_int, c_long};
use libuwuc::utils::SharedThinCstr;
#[no_mangle]
@ -15,6 +17,21 @@ pub unsafe extern "C" fn exit(code: i32) -> ! {
libuwuc::start::exit(code as i64 as _)
}
#[no_mangle]
pub unsafe extern "C" fn strtol(nptr: *const u8, endptr: *mut *const u8, base: c_int) -> c_long {
let str = SharedThinCstr::from_raw(nptr);
libuwuc::fmt::parse::parse_long(
str,
core::mem::transmute::<*mut *const u8, Option<&mut Option<SharedThinCstr<'_>>>>(endptr),
base,
)
}
#[no_mangle]
pub unsafe extern "C" fn strtoll(nptr: *const u8, endptr: *mut *const u8, base: c_int) -> c_long {
strtol(nptr, endptr, base)
}
#[no_mangle]
pub unsafe extern "C" fn getenv(name: *const u8) -> *const u8 {
libuwuc::env::getenv(SharedThinCstr::from_raw(name))