mirror of
https://github.com/Noratrieb/libuwuc.git
synced 2026-01-15 12:15:05 +01:00
strtol
This commit is contained in:
parent
9bfadd77d9
commit
84e6db0684
8 changed files with 252 additions and 13 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue