Re: getenv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy Cowgar wrote:
> 
> Kenneth Rhodes wrote:
> > 
> > If the problem is under Windows, shouldn't that
> > be where the fix is applied?
> >
> 
> Yes, that would be ideal, but I do think that is possible. Windows does not
> provide the means (that I can find) to tell if an environment variable is set
> with an empty value or unset. For both of those cases, it returns the same
> value.
> 
> So, we have two options. #1 dumb down the Linux version so that Euphoria is
> consistent or document that getenv() works differently on Windows and Linux
> (which is not my favorite option).
>  
> Maybe someone else knows a function call we can make in the win/dos api?
> 
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

It will never work under DOS:
in the environment segment, an env var is coded as follows:

<var-name>=<value>0

The 0 is the separator between two variable descriptions. From this, it would
follow that an empty string would be coded as

<var-name>=00

But 00 marks the end of the environment table.

And, since I strongly suspect M$ uses the same representation of an env block
under DOS and Windows, there is nothing as an env string with a null value under
Windows.

So how  did George get one? Simply because he entered it. For any operation on
environment, 0 is treated as a variable separator, not as a terminating \0. So
there is no inconsistency nor miracle. He didn't get it for long I bet.

CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu