{***********************************************************************}
{									}
{ __SpaceUtl  Report disk space utilization				}
{									}
{ function  __SpaceUtl(        Drive : byte;				}
{		       var AvailClus,					}
{			   TotalClus,					}
{			 BytesPerSec,					}
{			  SecsPerClus : word) : longint;		}
{									}
{	      Drive	The drive number.  0 = the current default	}
{			drive, 1 = drive A, 2 = drive B, etc.		}
{	      AvailClus Available (unallocated) clusters remaining on	}
{			the disk.					}
{	      TotalClus Total number of clusters on the disk.		}
{	      BytesPerSec						}
{			The number of bytes per sector. 		}
{	      SecsPerClus						}
{			The number of sectors per cluster.		}
{									}
{ Description Disk space is determined by the number of bytes per sec-	}
{	      tor, the number of sectors per cluster, and the number of }
{	      clusters on the disk.  These values vary based upon the	}
{	      type of drive, disk and operating system version.  This	}
{	      function returns the disk space information, and how many }
{	      clusters remain unallocated (space is always allocated in }
{	      clusters).   The function value is the total number of	}
{	      bytes in the unallocated clusters.			}
{									}
{	      If the drive number specified is invalid, all returned	}
{	      parameters are set to zero, and the function value is set }
{	      to -1. This function differs from the Turbo Pascal	}
{	      DiskFree and DiskSize library functions in that they do	}
{	      not return the disk cluster and sector information.	}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc. 1987		}
{_______________________________________________________________________}

function __SpaceUtl(Drive : byte;
			var AvailClus,TotalClus,
			    BytesPerSec,SecsPerClus : word) : longint;

  var
    Reg : registers;

  begin {__SpaceUtl}

    with Reg do 		       { Call DOS function $36		}
      begin
	AH := $36;
	DL := Drive;
	Intr(_DOS,Reg);
	if (AX = $FFFF) then
	   begin
	     AvailClus	 := 0;
	     TotalClus	 := 0;
	     BytesPerSec := 0;
	     SecsPerClus := 0;
	     __SpaceUtl  := -1
	   end
	else
	   begin
	     AvailClus	 := BX;
	     TotalClus	 := DX;
	     BytesPerSec := CX;
	     SecsPerClus := AX;
	     __SpaceUtl  := longint(BX) * longint(CX) * longint(AX)
	   end
      end

  end;	{__SpaceUtl}
