wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
envp.h File Reference

Read environment variables without libc. More...

Go to the source code of this file.

Functions

const char * wired_envp_get (int argc, char **argv, const char *name)
 Look up name in the environ block following argv.

Detailed Description

Read environment variables without libc.

wired_main receives only argc/argv, but a freestanding _start passes the kernel's initial stack through unchanged, so per the Linux ABI the NULL-terminated environ block sits right after argv: argv + argc + 1.

Function Documentation

◆ wired_envp_get()

const char * wired_envp_get ( int argc,
char ** argv,
const char * name )

Look up name in the environ block following argv.

Parameters
argcargument count
argvargument vector; argv[argc] is NULL and the environ block ("NAME=value" strings, NULL-terminated) follows it
nameNUL-terminated variable name without '=', e.g. "PROTOCOLS"
Returns
pointer to the NUL-terminated value (just past '='), which is the empty string for "NAME="; 0 when name is not present