more tests

This commit is contained in:
nora 2023-09-30 22:52:11 +02:00
parent 043c960708
commit 1827bd19c9
12 changed files with 240 additions and 72 deletions

View file

@ -13,7 +13,7 @@ pub unsafe extern "C" fn puts(s: *const c_char) -> i32 {
// PRINTF:
#[no_mangle]
pub unsafe extern "C" fn __printf_chk(_flag: c_int, format: *const c_char, mut args: ...) -> c_int {
pub unsafe extern "C" fn __printf_chk(_flag: c_int, format: *const u8, mut args: ...) -> c_int {
let mut sink = WriteCounter(stdout, 0);
let result = libuwuc::fmt::printf::printf_generic(

View file

@ -1,3 +1,5 @@
use libuwuc::utils::SharedThinCstr;
#[no_mangle]
pub unsafe extern "C" fn malloc(size: usize) -> *mut u8 {
libuwuc::alloc::malloc_zeroed(size, 16)
@ -12,3 +14,10 @@ pub unsafe extern "C" fn free(ptr: *mut u8) {
pub unsafe extern "C" fn exit(code: i32) -> ! {
libuwuc::start::exit(code as i64 as _)
}
#[no_mangle]
pub unsafe extern "C" fn getenv(name: *const u8) -> *const u8 {
libuwuc::env::getenv(SharedThinCstr::from_raw(name))
.map(SharedThinCstr::as_raw)
.unwrap_or(core::ptr::null())
}