I have been thinking a little about environment variables and have a few questions/observations.
putenv(char *string);
This call seems
Read the RATIONALE section of the setenv man page from The Open Group Base Specifications Issue 6.
putenv and setenv are both supposed to be POSIX compliant. If you have code with putenv in it, and the code works well, leave it alone. If you are developing new code you may want to consider setenv.
Look at the glibc source code if you want to see an example of an implementation of setenv (stdlib/setenv.c) or putenv (stdlib/putenv.c).