cvs.delorie.com/djgpp/doc/libc/libc_698.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

setenv

Syntax

 
#include <stdlib.h>

int setenv(const char *name, const char *value, int rewrite);

Description

This function sets the environment variable name to value. If rewrite is set, then this function will replace any existing value. If it is not set, it will only put the variable into the environment if that variable isn't already defined.

Return Value

Zero on success, -1 on failure; errno is set to the reason for failure: EINVAL if the name parameter is NULL or points to an empty string, or ENOMEM if there was insufficient memory to add the variable to the environment.

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001 (see note 1)

Notes:

  1. This function is new to the Posix 1003.1-200x draft. Our implementation allows name to contain a `=', while the POSIX spec does not; the portion of name up to but not including the `=' will be used as the name for the environment variable.

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004