Web lists-archives.org

Re: [Mingw-users] How can I tell whether my prog is running on cmd.exe or bash?




Paul Leder wrote:

> There's currently one fly in the ointment, though. I 
> noticed last night that 'getenv' is not picking up SHELL. Any other 
> environment variable you care to name, but not SHELL, despite 'set' 
> confirming that it exists. I'll try to work that one out as soon as I 
> finish the displacement activities...

Sorry to go on about this...

There's no SHELL in MinGW's 'environ'. To be precise, I've written a 
small test prog that prints out the contents of stdlib's 'environ'. This 
is what I'm seeing, running everything from a Cygwin bash shell:

$ environ_dump.exe > env1
$ sort env1 > env1s
$ wc env1s
   44 65 1464 env1s
$ set > env2
$ sort env2 > env2s
$ wc env2s
   74 104 2062 env2s

Comparing env1s and env2s, I see:

1 - various bash environment variables never made it as far as 
'environ'. These include all the BASH* variables, OSTYPE, SHELL, and so on.

2 - Various single-quoted variables from env2s end up unquoted in 'environ'.

3 - various other minor changes.

At first sight, it appears that all the bash and cygwin-specific stuff 
has been left out of environ, but there a lot of it is still there - 
CVS_RSH, HOME, and so on.

Presumably I'm doing something really dumb. Any ideas? This is a 
more-or-less out-of-the-box Win2K machine which I use for testing.

Thanks

-Paul


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users