[comp.sys.amiga.programmer] Questions to the keeper

umrobbin@ccu.umanitoba.ca (01/29/91)

Hi!

When one is scanning through a directory, using Examine() and ExNext(),
my DOS manual (v1.1) says to look at the type value of the FileInfoBlock to
decide whether the entry is a directory or file.

But in the structure, there is a DirEntryType and an EntryType.  In my 1.3
includes, the DirEntryType has a comment to the effect that this one is 
positive for directories and negative for files.  The EntryType, however, has
no comments at all.

On the disks I checked, these two values were always identical.  Directories
were 2 and files were -3.  Apparently there is no difference between them,
so what is their history?  Are they the same in FFS as well?  For maximum
safety in upward compatibility, should I be using DirEntryType?
Why 2 and -3?

Second Question:

I have a bit of source for an 'ls' program (which may be quite ancient).
In it, there is a comment to the effect that the safest way to lock the
current directory is
        cd_lock = CurrentDir(0);
"because of bugs in the V1.1 RAM handler".  What was the problem?  Have these
bugs and possible similar ones been killed?  What is the safest way to lock
the current directory?  I've been using
        cd_lock = Lock("",ACCESS_READ);
with no apparent problems, is this okay?

Steve Robbins
<umrobbin@ccu.umanitoba.ca>

jesup@cbmvax.commodore.com (Randell Jesup) (01/30/91)

In article <1991Jan29.095740.9133@ccu.umanitoba.ca> umrobbin@ccu.umanitoba.ca writes:
>On the disks I checked, these two values were always identical.  Directories
>were 2 and files were -3.  Apparently there is no difference between them,
>so what is their history?  Are they the same in FFS as well?  For maximum
>safety in upward compatibility, should I be using DirEntryType?
>Why 2 and -3?

	Because of that unfortunate lack of documentation, we're kind of stuck
with keeping them the same.  However, you should use fib_DirEntryType.

>bugs and possible similar ones been killed?  What is the safest way to lock
>the current directory?  I've been using
>        cd_lock = Lock("",ACCESS_READ);
>with no apparent problems, is this okay?

	That's fine.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com  BIX: rjesup  
The compiler runs
Like a swift-flowing river
I wait in silence.  (From "The Zen of Programming")  ;-)