{***********************************************************************}
{									}
{ __IsConFil  Is a file attached to the console?			}
{									}
{ function  __IsConFil(Handle : word) : boolean;			}
{									}
{   Handle    The handle of the file for which you wish to determine if }
{	      it is attached to the console.				}
{									}
{ Description Because DOS allows redirection for standard input and	}
{	      output, it is not always the case that they are attached	}
{	      to the console (screen and keyboard).  This function	}
{	      allows you to determine what the status is.  The function }
{	      value is TRUE if the handle refers to the console devices,}
{	      and FALSE otherwise (that is, a disk device).  __IsConFil }
{	      is useful for those applications that need to allow	}
{	      redirection (for example, "filters"), but should behave	}
{	      differently if either the output or input is not a disk	}
{	      file.							}
{									}
{	      The DOS IOCTL function ($44) "Get device information"	}
{	      is used to determine the status of the file.		}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc.  1987		}
{_______________________________________________________________________}

function  __IsConFil(Handle : word) : boolean;

  var
    Reg : registers;

  begin {__IsConFil}

    with Reg do
      begin
	AH := $44;		       { DOS IOCTL function		}
	AL := 0;		       { Get Device Information 	}
	BX := Handle;
	Intr(_DOS,Reg);
	__IsConFil := ((DL and $80) <> 0) and ((DL and $03) <> 0)
      end

  end;	{__IsConFil}
