On Tue, Feb 22, 2005 at 08:24:07AM +0100, Tim Van Holder wrote: > 3) I'm not 100% sure, but I _think_ it is allowed to > modify the string you passed to putenv later, and that > such changes will have effect on future getenv() calls; > that behaviour is broken by your version of putenv().
You're right, I hadn't thought of that. According to the POSIX standard (IEEE Std 1003.1, 2003 Edition), | The 'string' argument should point to a string of the form " name= | value ". The putenv() function shall make the value of the | environment variable 'name' equal to 'value' by altering an | existing variable or creating a new one. In either case, the | string pointed to by 'string' shall become part of the | environment, so altering the string shall change the environment. James.