mirror of
https://github.com/Noratrieb/libuwuc.git
synced 2026-01-14 19:55:07 +01:00
tests
This commit is contained in:
parent
ae189e8b18
commit
043c960708
15 changed files with 206 additions and 23 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#![no_std]
|
||||
#![feature(c_variadic)]
|
||||
#![feature(panic_info_message)]
|
||||
#![deny(clippy::no_mangle_with_rust_abi)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,33 @@
|
|||
use core::ffi::{c_char, c_int};
|
||||
|
||||
use libuwuc::io::{stream::FileStream, STDERR, STDIN, STDOUT};
|
||||
use libuwuc::{
|
||||
io::{stream::FileStream, traits::WriteCounter, STDERR, STDIN, STDOUT},
|
||||
utils::SharedThinCstr,
|
||||
};
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn puts(s: *const c_char) -> i32 {
|
||||
libuwuc::io::puts(s)
|
||||
}
|
||||
|
||||
// PRINTF:
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn __printf_chk(_flag: c_int, format: *const c_char, mut args: ...) -> c_int {
|
||||
let mut sink = WriteCounter(stdout, 0);
|
||||
|
||||
let result = libuwuc::fmt::printf::printf_generic(
|
||||
&mut sink,
|
||||
SharedThinCstr::from_raw(format),
|
||||
args.as_va_list(),
|
||||
);
|
||||
|
||||
match result {
|
||||
Ok(()) => sink.1 as _,
|
||||
Err(err) => err,
|
||||
}
|
||||
}
|
||||
|
||||
// STREAMS:
|
||||
|
||||
#[no_mangle]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue