delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/24/01:06:02

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Win95 LFNs With v2.01 (Changes?)
Date: Wed, 23 Oct 1996 20:10:50 -0700
Organization: Three pounds of chaos and a pinch of salt
Lines: 46
Message-ID: <326EDE3A.E46@cs.com>
References: <slrn56rmuq DOT 41 DOT davep AT hagbard DOT demon DOT co DOT uk>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp110.cs.com
Mime-Version: 1.0
To: Dave Pearson <davep AT hagbard DOT demon DOT co DOT uk>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Dave Pearson wrote:
> 
> If I compile this with 2.0, and LFN is not in the environment and in
> ~djgpp/djgpp.env LFN is set to N (and DJGPP points to it) it will
> happily open a long file name. With 2.01 it won't, I either have to
> set LFN to 'y' in the environment, set LFN to 'y' in ~djgpp/djgpp.env
> or unset DJGPP.
> 
> Am I going mad or has there been a change?

There has, and it was because the way LFNs were handled in v2.00 was a
bug.  The 'LFN' setting in DJGPP.ENV was _not_ checked before the
program that initially read it received the value of the _USE_LFN
macro.  Thus, if LFN's were enabled in the environment (i.e., running
under Win95), they would be enabled in DJGPP programs as well even if
LFN=n was set in DJGPP.ENV.  _However_, the second and subsequent DJGPP
programs in a given execution tree _would_ inherit the LFN=n setting
read from DJGPP.ENV, and happily ignore long filenames.  The only way
around this bug was to manually set LFN in the DOS environment before
running any DJGPP programs.

v2.01 fixes this bug by reading the DJGPP.ENV environment before
evaluating the _USE_LFN macro.  Of course, this also means that in order
to enable LFN's under DJGPP, you have to either change DJGPP.ENV, or set
it from DOS.  Leaving the default setting alone will always disable long
filenames.

Basically, if you are running under an LFN-capable system, and your
programs are capable of operating correctly in both LFN and non-LFN
environments, you should set LFN=y either in your system or in
DJGPP.ENV.  Even if you do set LFN=y, if long filenames are not
supported, your programs will be so informed.

Hope this helps!

-- 
John M. Aldrich <fighteer AT cs DOT com>                      

* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
  causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
  again.
* It doesn't necessarily do it in chronological order, though.
 
                                       --- Douglas Adams

- Raw text -


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