posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
stdlib.h File Reference

<stdlib.h>: POSIX extensions to the C standard library More...

#include <stddef.h>
Include dependency graph for posix_stdlib.h:

Go to the source code of this file.

Functions

int getenv_r (const char *name, char *buf, size_t len)
 Get an environment variable into a caller-supplied buffer (BSD extension).
 
int getsubopt (char **optionp, char *const *keylistp, char **valuep)
 Parse sub-options from a command-line argument string.
 
int putenv (char *string)
 Add or change an environment variable (XSI extension).
 
int setenv (const char *envname, const char *envval, int overwrite)
 Set the value of an environment variable.
 
int unsetenv (const char *name)
 Remove an environment variable.
 
int rand_r (unsigned int *seed)
 Generate a pseudo-random number (reentrant).
 
void qsort_r (void *base, size_t nmemb, size_t size, int(*compar)(const void *a, const void *b, void *arg), void *arg)
 Sort an array with a comparison function that takes a context argument.
 

Detailed Description

<stdlib.h>: POSIX extensions to the C standard library

Provides POSIX and XSI extensions to the standard <stdlib.h> interface, including environment variable manipulation and sub-option parsing.

See also
POSIX.1-2017 <stdlib.h>

Definition in file stdlib.h.

Function Documentation

◆ getenv_r()

int getenv_r ( const char *  name,
char *  buf,
size_t  len 
)

Get an environment variable into a caller-supplied buffer (BSD extension).

Parameters
nameName of the environment variable.
bufBuffer to write the value into.
lenSize of buf.
Returns
0 on success, or a positive error number on failure (ENOENT if not set, ERANGE if buf is too small).