mirror of
https://github.com/Noratrieb/libuwuc.git
synced 2026-01-14 19:55:07 +01:00
getenv works
This commit is contained in:
parent
0c69d7db10
commit
9464ea4829
7 changed files with 206 additions and 33 deletions
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use core::ffi::c_char;
|
||||
|
||||
use libuwuc::println;
|
||||
use libuwuc::{println, utils::SharedThinCstr};
|
||||
|
||||
extern crate libuwuc;
|
||||
|
||||
|
|
@ -23,5 +23,15 @@ fn handler(arg: &core::panic::PanicInfo) -> ! {
|
|||
#[no_mangle]
|
||||
extern "C" fn main(_argc: i32, _argv: *const *const c_char) -> i32 {
|
||||
println!("Hello, world!");
|
||||
let pwd = libuwuc::env::getenv(SharedThinCstr::from_array(b"PWD\0"));
|
||||
println!("PWD={pwd:?}");
|
||||
0
|
||||
}
|
||||
|
||||
// libcore seems to require this symbol, even though it's unused.
|
||||
#[no_mangle]
|
||||
fn rust_eh_personality() {
|
||||
unsafe {
|
||||
libuwuc::trap!();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue