[comp.sys.atari.st] Problems with Fattrib on a directory

UDAC041%UK.AC.KCL.CC.VAXA@ac.uk.UUCP (02/18/87)

Subject:  Fattrib problems reading directories


Hi,

I have been using 'Fattrib' gemdos function to read the attributes of a
directory but all it returns is 0 without bit 0x10 set to indicate that
it is a directory.

Am I doing something wrong ? Or isn't supposed to give the attributes of a
directory ?

I get the correect results for files (ie. read only).

Can any one help ?

Thanks in advance,

Andrew Smith.

bammi@cwruecmp.UUCP (02/18/87)

In article <8702170915.AA29778@jade.berkeley.edu> UDAC041%UK.AC.KCL.CC.VAXA@ac.uk writes:
>Subject:  Fattrib problems reading directories
>
>
>I have been using 'Fattrib' gemdos function to read the attributes of a
>directory but all it returns is 0 without bit 0x10 set to indicate that
>it is a directory.
>
	I too came across this `bug', and reported it to Atari. Only god
knows if they are doing something about it. Anyway, the work around is to
use Fsfirst() after setting up your Dta, and then picking up the attributes
from the Dta. That works just fine.
-- 
usenet: .....!decvax!cwruecmp!bammi		jwahar r. bammi
csnet:       bammi@case
arpa:        bammi%case@csnet-relay
compuServe:  71515,155

gert@nikhefh.UUCP (02/20/87)

In article <8702170915.AA29778@jade.berkeley.edu> UDAC041%UK.AC.KCL.CC.VAXA@ac.uk writes:
>Subject:  Fattrib problems reading directories
>
>
>Hi,
>
>I have been using 'Fattrib' gemdos function to read the attributes of a
>directory but all it returns is 0 without bit 0x10 set to indicate that
>it is a directory.
>
>Am I doing something wrong ? Or isn't supposed to give the attributes of a
>directory ?
>
>I get the correect results for files (ie. read only).
>
>Can any one help ?
>
>Thanks in advance,
>
>Andrew Smith.


	Try this:


mode ( name )
char	*name;
{
	struct DTA	myDta, *oldDta;

	oldDta = (struct DTA *)Fgetdta();
	Fsetdta ( myDta );
	if (( errno = Fsfirst ( name, -1 ) < 0 ))
		return ( -1 );  /* this can never be a valid mode */
	Fsetdta ( oldDta );
	return ( myDta.attr );
}



Succes...


Gert Poletiek
Dutch National Institute for High Energy Physics

leavens@atari.UUCP (03/04/87)

> I have been using 'Fattrib' gemdos function to read the attributes of a
> directory but all it returns is 0 without bit 0x10 set to indicate that
> it is a directory.

I just spoke with one of the programmers, and apparently you can't read 
the directory bit using Fattrib.  This is because Fattrib has the possibility
of changing the values for this attribute bit, and since doing so would
roach the system (you don't want to set a non-directory file to a directory,
and vice-versa), the call just doesn't return that info.  The programmer
suggested using Fsfirst, which also returns the attrib info, but in a read-only
fashion.

--alex (The Other One)