delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/12/03/17:01:19

From: soorya AT calgary DOT hp DOT com ("Soorya Kuloor")
Subject: Env variable name trouble
3 Dec 1996 17:01:19 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199612040009.AA262788182.cygnus.gnu-win32@hpcpdca.calgary.hp.com>
Mime-Version: 1.0
Original-To: <gnu-win32 AT cygnus DOT com>
Original-Cc: <soorya AT calgary DOT hp DOT com>
X-Msmail-Priority: Normal
X-Priority: 3
X-Mailer: Microsoft Internet Mail 4.70.1155
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Hi,

(This mail is a bit long. So please be patient.)

I  use GNU-WIN32/bash on a machine with the following config:

CPU : P6/200
OS:    WinNT 4.0
GNU-WIN32 beta 16

I set an environment variable in bash with mixed case name, for example
includeFilesDir as
	export includeFilesDir=blablabla

Then if I start a subshell, in the subshell the name of the env variable
gets changed to INCLUDEFILESDIR, so
	echo $includeFilesDir
in the subshell does not work.

Similarly, the following source code when compiled using gcc and MS Visual
C++ 4.2 behaves 
differently.

----------------------------------------------------------------------------
-------------------------------
#include <stdio.h>

extern char **environ;

main()
{
    int i;
    char *p;
    for(i = 0; ; i++) {
        p = environ[i];
        if(p == NULL) break;
        else printf("%s\n", p);
    }
}
----------------------------------------------------------------------------
------------------------------------

In case of gcc generated executable, all the env variable names are in
uppercase, whereas
VC++ generated executable retains case. This happens even if I run the
programs from 
dos-shell. So is it something to do with how libc.a/crtxx.o/cygwin32.dll
work??

Another interesting observation:
	I got tcl7.6 win32 pre-compiled binaries from sun and installed it. It
also uppercased the environment variables names (env array). (tcl7.6 does
not use any of GNU-WIN32 tools on NT).
However when I rebuilt tcl7.6 from source on NT the problem went away. The
newly built tcl76 shell
now retains case. So, now I am thoroughly confused. Has it got something to
do with the
VC++ 4.2 version of the compiler that I am using? I don't know which
compiler was used to build
tcl7.6 prebuilt binaries by Sun. Tcl7.6 builds with both BC++ and VC++
compilers.

Any help as to how to fix this problem, or a work around (other than using
all upper case env
variable names :-)) this problem will be greatly appreciated.

Thanks, bye,
Soorya
------------
soorya AT calgary DOT hp DOT com

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019