{***********************************************************************}
{									}
{ __RetAtFil  Return the attribute of a file				}
{									}
{ procedure __RetAtFil(     Pathname : _Path;				}
{			var FileAttr : byte;				}
{		       var ErrorCode : word);				}
{									}
{	      PathName	File path name of the file whose attribute	}
{			is to be returned.				}
{	      FileAttr	Returned attribute of the file. 		}
{	      ErrorCode The returned error status code: 		}
{			(0) File attribute successfully returned.	}
{			(2) File not found.				}
{			(3) Path not found.  One of the entries in the	}
{			    path was not present.			}
{			If DOS version 3.0 or later is used, a call to	}
{			__RetErUtl can be made to return more informa-	}
{			tion on the error.				}
{									}
{ Description __RetAtFil returns the current file attribute.  See	}
{	      __SetAtFil for a list and description of the file 	}
{	      attributes. If an error is encountered, 0 is returned	}
{	      as the file attribute.					}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc.  1987		}
{_______________________________________________________________________}

procedure __RetAtFil(	  PathName : _Path;
		      var FileAttr : byte;
		     var ErrorCode : word);

  var
    PathZ   : _Path;		       { ASCIIZ string for PathName	}
    PathLen : integer;
    Reg     : registers;

  begin {__RetAtFil}

    { First construct the ASCIIZ string representing the path name.	}
    { Notice that PathName is moved to PathZ[0], and the trailing NULL	}
    { character is put at PathZ[Length(PathName)].			}

    PathLen := Length(PathName);
    Move(PathName[1],PathZ,PathLen);
    PathZ[PathLen] := #0;

    with Reg do
      begin
	AX := $4300;		       { AL = 0 to return the attribute }
	DS := Seg(PathZ);
	DX := Ofs(PathZ);
	Intr(_DOS,Reg);
	if ((Flags and FCarry) <> 0) then
	   begin
	     ErrorCode := AX;
	     FileAttr  := 0
	   end
	else
	   begin
	     ErrorCode := 0;
	     FileAttr  := CX
	   end
     end

  end;	{__RetAtFil}
