01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PUTENV (3C) PUTENV (3C)<br />

NAME<br />

putenv - change or add value to environment<br />

SYNOPSIS<br />

int putenv (string)<br />

char *string;<br />

DESCRIPTION<br />

String points to a string of the form "name=value." Putenv<br />

makes the value of the environment variable name equal to value<br />

by altering an existing variable or creating a new one. In either<br />

case, the string pointed to by string becomes part of the environment,<br />

so altering the string will change the environment. The<br />

space used by string is no longer used once a new string-defining<br />

name is passed to putenv.<br />

SEE ALSO<br />

exec(2), getenv(3C), malloc(3C), environ(S).<br />

DIAGNOSTICS<br />

Putenv returns non-zero if it was unable to obtain enough space<br />

via malloc for an expanded environment, otherwise zero.<br />

WARNINGS<br />

Putenv manipulates the environment pointed to by environ, and<br />

can be used in conjunction with getenv. However, envp (the third<br />

argument to main ) is not changed.<br />

This routine uses malloc(3C) to enlarge the environment.<br />

After putenv is called, environmental variables are not in alphabetical<br />

order.<br />

A potential error is to call putenv with an automatic variable as<br />

the argument, then exit the calling function while string is still<br />

part of the environment.<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!