[Previous]
[Contents]
[Next]

clearenv()

clear the process environment area

Synopsis:

#include <env.h>
int clearenv( void );

Description:

The clearenv() function clears the process environment area. No environment variables are defined immediately after a call to it.


Note: This clears the following environment variables, which may then affect the operation of other library functions:
  • PATH
  • SHELL
  • TERM
  • TERMINFO
  • LINES
  • COLUMNS
  • TZ

The clearenv() function may manipulate the value of the pointer environ.

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

ENOMEM
Not enough memory to allocate a control structure.

Examples:

The following example clears the entire environment area and sets up a new TZ environment variable.

#include <env.h>

void main()
  {
    clearenv();
    setenv( "TZ", "EST5EDT", 0 );
  }

Classification:

WATCOM

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

errno, exec... functions, getenv(), putenv(), _searchenv(), searchenv(), setenv(), spawn... functions, system()


[Previous]
[Contents]
[Next]