mirror of
https://github.com/Noratrieb/libuwuc.git
synced 2026-01-14 19:55:07 +01:00
more io
This commit is contained in:
parent
5673cf51db
commit
ae189e8b18
3 changed files with 79 additions and 1 deletions
|
|
@ -1,6 +1,32 @@
|
|||
use core::ffi::c_char;
|
||||
use core::ffi::{c_char, c_int};
|
||||
|
||||
use libuwuc::io::{stream::FileStream, STDERR, STDIN, STDOUT};
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn puts(s: *const c_char) -> i32 {
|
||||
libuwuc::io::puts(s)
|
||||
}
|
||||
|
||||
// STREAMS:
|
||||
|
||||
#[no_mangle]
|
||||
pub static stdin: &FileStream = &FileStream::from_raw_fd(STDIN);
|
||||
#[no_mangle]
|
||||
pub static stdout: &FileStream = &FileStream::from_raw_fd(STDOUT);
|
||||
#[no_mangle]
|
||||
pub static stderr: &FileStream = &FileStream::from_raw_fd(STDERR);
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn fputc(c: c_int, stream: *mut FileStream) -> c_int {
|
||||
libuwuc::io::stream::fputc(c as u8, &*stream)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn fwrite(
|
||||
ptr: *const u8,
|
||||
size: usize,
|
||||
nitems: usize,
|
||||
stream: &FileStream,
|
||||
) -> usize {
|
||||
libuwuc::io::stream::fwrite(ptr, size, nitems, stream)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue