delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/25/06:50:06

Date: Tue, 25 May 1999 13:47:36 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Anton Helm <tony AT nt DOT tuwien DOT ac DOT at>
cc: djgpp AT delorie DOT com
Subject: Re: Environment variables and getenv()
In-Reply-To: <4.1.19990525113803.00a6e7a0@hal.nt.tuwien.ac.at>
Message-ID: <Pine.SUN.3.91.990525134038.5532A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 25 May 1999, Anton Helm wrote:

> The PCs are running W98 (most likely a french version, but I 
> haven't yet found out definetly) and the "PATH" is spelled "Path"
> when you look at the environment with "set". Changing it to "PATH"
> seems to make it work correctly.

This would indicate that the variable set is "Path", not "PATH".

> My WinNT4.0 also uses "Path" but returns it's contents correctly when
> I call getenv("PATH").

That's because NT up-cases all environment variables that it passes to 
DOS programs.  If it didn't, nothing in DJGPP would work, because NT 
always uses capitalized environment variables ("Path", "ComSpec" etc.).

> AFAIK DOS et. al. stores environmemt variables in the way they are typed in, but 
> interpretes them caseINsensitive.

No.  DOS doesn't treat environment variables case-insensitively.  In 
fact, DOS doesn't care (nothing in the DOS kernel ever accesses the 
environment, AFAIK).  It is COMMAND.COM and application programs that 
access them, and they all treat them case-sensitively IIRC.

The impression that environment variables are caseless stems from the 
fact that COMMAND.COM automatically up-cases the variable names (not 
values, mind you) when you type "SET foo=bar" from the command line.  So 
there's no simple way for the user to set an environment variable whose 
name isn't all upper-case.

- Raw text -


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