Mail Archives: djgpp/1998/05/05/03:01:45
Eli Zaretskii wrote:
>
> On Mon, 4 May 1998, Salvador Eduardo Tropea (SET) wrote:
>
> > That's why I call truename, the editor can't open twice the same file (can but
> > is a mess so avoid it). So I pass the name provided by the user to truename
> > (only when LFN=N) and as the result is ugly I then pass it to fixpath.
>
> If that is what you need, then just pass the two file names to `stat' and
> compare st_dev and st_ino; `stat' will do the rest for you. This is the
> standard Unix way of testing two files for equivalence (it also works for
> links), and making DJGPP's `stat' work like this was one of the original
> reasons for writing a new version of `stat' for DJGPP v2. (Too many Unix
> programs rely on this method, and most other DOS implementations of `stat'
> just return zero in st_ino.)
Hmm, this can easily fail on a redirected network drive.
Under Novell, I can do nasty things as
MAP ROOT i:=usr:home/demmer/djgpp
MAP ROOT k:=usr:home/demmer/djgpp/bin
cp i:/bin/gcc.exe k:/gcc.exe
and end up with a nuked gcc.exe, because both names refer to the
same file. stat() will happily report both of them being
different files, when in fact they are the same. IIRC, stat()
keeps track of filenames on a drive level to invent inodes.
The concept of drive letters is so brain-dead that it hurts,
but what can you do?
--
Ciao
Tom
*************************************************************
* Thomas Demmer *
* Lehrstuhl fuer Stroemungsmechanik *
* Ruhr-Uni-Bochum *
* Universitaetsstr. 150 *
* D-44780 Bochum *
* Tel: +49 234 700 6434 *
* Fax: +49 234 709 4162 *
* http://www.lstm.ruhr-uni-bochum.de/~demmer *
*************************************************************
- Raw text -