Env is a Zen-C library for accessing the environment of the process environment.
import "std/env.zc"
fn main() {
Env::set("HELLO", "world");
let hello = Env::get("HELLO");
if (hello.is_some()) {
println "Hello {hello.unwrap()}";
}
}
enum EnvRes {
ERR,
OK,
}
Retrieves the env-variable as borrowed string (char *) (no alloc)
fn get(name: string) -> Option<string>
Retrieves the env-variable as caller-owned String() (heap alloc)
fn get_dup(name: string) -> Option<String>
Sets an env-variable
fn set(name: string, value: string) -> EnvRes
Unsets an existing env-variable
fn unset(name: string) -> EnvRes
Check the examples folder for more.