bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Portability issue with `putenv'


From: Sam Lauber
Subject: Re: Portability issue with `putenv'
Date: Tue, 22 Feb 2005 16:45:42 +0100

>> 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.  

According to the DJGPP C Library manual, it seems to say 
things are the other way around.  It says that the string 
is _supposed_ to be copied.  

But if there's at least one C library or compiler that's 
not standards compliant, someone has to cater to them or 
risk that construct being nonportable without anyone 
knowing it, everyone using it, only to break on a platform 
like DJGPP.  (I can justify that it's the job of Autoconf 
to track down those things.).  

Samuel Lauber

P.S. Nowadays, I've noticed a lot of free software is 
impolite to DOS systems.  

-- 
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
From your mailbox to local or overseas cell phones.

Powered by Outblaze




reply via email to

[Prev in Thread] Current Thread [Next in Thread]