LIBAST(3ast) LIBAST(3ast)

# [NAME](#NAME)

setenviron - set environment value

# [SYNOPSIS](#SYNOPSIS)

```
#include <ast.h>
char*     setenviron(const char* key);
```

# [DESCRIPTION](#DESCRIPTION)

setenviron controls environment *name=value* pairs. setenviron("*name=value*") adds *name* to the environment and returns a pointer to a [*strdup*(3)](/man/os/ksh/strdup.3) copy of *name=value*. setenviron("*name*") removes *name* from the environment and returns the empty string. setenviron(0) reserves a few slots in an internal array and is usually called by a parent process that expects many children. 0 is returned on error. setenviron preserves the [*ksh*(1)](/man/os/ksh/ksh.1) convention of _ as the first environment variable name.

# [SEE ALSO](#SEE_ALSO)

[env(1)](/man/os/ksh/env.1), [exec(2)](/man/os/ksh/exec.2)

---

Document: setenviron(3ast) from ksh 1.0.10-r37 (Chainguard OS)
Source: https://github.com/ksh93/ksh
