Sender: salvador AT delorie DOT com Message-ID: <3BB9C9AA.7B4E13BF@inti.gov.ar> Date: Tue, 02 Oct 2001 11:05:31 -0300 From: salvador Organization: INTI X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i686) X-Accept-Language: es-AR, en, es MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: putenv question References: <10110020339 DOT AA16416 AT clio DOT rice DOT edu> <1002006261 DOT 19672 DOT 6 DOT camel AT bender DOT falconsoft DOT be> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Tim Van Holder wrote: > On Tue, 2001-10-02 at 05:39, Charles Sandmann wrote: > > I don't have a posix standard, so a simple question ... > > > > putenv in 2.03 took a const char * argument > > > > When it was moved to the posix section in cvs it is no longer const > > When I passed the const strings "lfn=" in mntent I had to unconst > > the strings to avoid warnings. Is it against the standard or some > > other way bad for this to be const in the headers? Just wondering. > > Since the POSIX draft standard listed putenv's argument as a non-const > char*, I changed our implementation to match (and added a note about > this to wc204.txi). > I don't really see why it can't be const, but I felt it would be best to > follow the standard. Perhaps is related to the fact that not all implementations makes a copy (as djgpp does) and hence a const could generate problems. What is supposed to return getenv() according to the standard? is it a char *? The djgpp's help clearly states the behavior of putenv and warns about what other implementations does, but I felt victim of a stupid bug anyways: void function() { char buffer[xx]; strcpy(buffer,...); putenv(buffer); } ;-) Of course it generates really bizarre things with GNU libc (which doesn't copy the string). SET -- Salvador Eduardo Tropea (SET). (Electronics Engineer) Visit my home page: http://welcome.to/SetSoft or http://www.geocities.com/SiliconValley/Vista/6552/ Alternative e-mail: set AT computer DOT org set AT ieee DOT org Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013