Gah! I
hate it when people only think of
user programs and not
obvious libc calls.
Prototyped in <stdlib.h>, setenv() sets an environment variable. It takes three args: the first a name string, the second a value string, and the third an int Boolean for whether or not it should be overwritten if it already exists.
int setenv( const char *name, const char *value, int overwrite );
There is also
getenv() which gets a value, and
unsetenv() which
deletes it. Both of these take one arg: a
name string.