Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ putenv(3C) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

getenv(3C)

malloc(3C)

environ(5)




putenv(3C) putenv(3C)
NAME putenv - changes existing environmental variable values or adds new ones SYNOPSIS int putenv(string) char *string; DESCRIPTION putenv is a function that makes the value of the environment variable name equal to value by altering an existing variable or creating a new one. The input parameter string points to a string that has the form name = value In either case, the string pointed to by string becomes part of the environment, so altering the string will change the environment. The space used by string is no longer used once a new string-defining name argument is passed to putenv. STATUS MESSAGES AND VALUES The putenv function returns a nonzero value if it was unable to obtain enough space by means of malloc for an expanded environment; otherwise, putenv returns zero. WARNINGS The putenv function manipulates the environment pointed to by environ and can be used in conjunction with getenv. However, envp (the third argument to main) is not changed. This routine uses malloc(3C) to enlarge the environment. After putenv is called, environment variables are not in alphabetical order. An error may result if you call putenv with an automatic variable as the argument, then exit the calling function while string is still part of the environment. SEE ALSO exec(2), getenv(3C), malloc(3C), environ(5) January 1992 1

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026