This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: getenv implementation?
On Mon, Aug 30, 2004 at 01:31:58AM +0200, Tobias Schl?ter wrote:
> Steve Kargl wrote:
> > On Mon, Aug 30, 2004 at 01:00:50AM +0200, Tobias Schl?ter wrote:
> >>Try this:
> >>
> >>Steve Kargl wrote:
> >>
> >>> character*7 name, value
> >> ^^^
>
>> From your answer it appears that I wasn't clear enough: what I meant
>> to say is that if you replace '*70' by '*7' (==LENGTH("DISPLAY")),
>> your program magically works. That is because the trailing spaces are
>> not stripped in our implementation of getenv. The question about g77
>> was because I was wondering how or if g77 deals with this.
>
Yeah, I misunderstood your original reply. As to g77, it appears
to strip trailing spaces and in fact looks for the first space
character to determine the end of the variable.
kargl[263] setenv | grep SPACE
SPACE TEST=One Space
SPACE=Ahoy
kargl[264] cat aa.f
program aa
character*70 name, value
name = 'SPACE TEST'
call getenv(name,value)
print*, 'name = ', name
print*, 'value = ', value
end
kargl[265] ./aa
name = SPACE TEST
value = Ahoy
--
Steve