delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/08/13/03:18:18

Date: Tue, 13 Aug 1996 10:13:31 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp-workers AT delorie DOT com
Subject: LFN woes (again)
Message-Id: <Pine.SUN.3.91.960813093756.28748W-100000@is>
Mime-Version: 1.0

I have access to a Windows 95 machine for a few days, so I thought I'd 
figure out all the gory little details required to make DJGPP more 
LFN-clean.  I now have a concept that seems to work fairly well.  I'd 
like to hear comments before I begin changing a few library functions 
that need to be corrected and submit the changes.  So here goes:

We cannot simply avoid downcasing filenames under LFN, because this will
show most or all the 8.3 names ugly uppercased.  Actually, Windows 95
allows you to rename a 8.3 filename to lowercase (like in "ren MYFILE.EXT
myfile.ext") in which case you will see it in lower case under LFN, but I
think we cannot trust users to run such a procedure on their entire disk. 
(A program that does such a conversion would be nice, though.) So we must
sometimes downcase, even under LFN, and the hard thing is to decide when. 
I suggest using an LFN function (Int 21h/AX=71A8h) which returns a short
name for a given filename: if it returns a name which is identical
(including the case) to its input, we *know* we have a DOS-style name. 

Every piece of code that needs to deal with this kind of problems, should 
call the above function and act accordingly.  I suggest the following:

`glob' will downcase DOS-style names unless the pattern includes an
uppercase letter.  If there is an uppercase letter in the pattern, then
matches against the pattern will be case-sensitive.  Filenames that are
not DOS-style will not be downcased, but if the pattern was all
lower-case, the matches will be case-insensitive. 

`readdir', `getcwd', etc. will all downcase DOS-style names.

I plan to have a global flag and an environment variable that will defeat 
downcasing altogether, for those people that will want to actually rename 
all files to their true case.  For instance, if you want to have files 
like README, INSTALL and FAQ and to treat them as upper-case, you would 
like to use such an option.

I think the above should work in most cases, with the true-case option
serving as a stopgap for those cases when the default setup fails.  Some
programs might still have to do special things to avoid failing, though. 
An example is Make where we would probably like to make sure that a rule
that builds a file named README will not fail, no matter what the case of
the file's name actually is.  But I think the above provides enough tools
for such programs to do whatever they need without adversely affecting the
rest of the library. 

Please send me any comments you have, because I'd like to submit the 
changes by the end of this week.  Thanks.

- Raw text -


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