home *** CD-ROM | disk | FTP | other *** search
/ TopWare Tools / TOOLS.iso / tools / top1318 / gepackt.exe / UTILITY / SOURCE / FREEA.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-02-03  |  1017 b   |  47 lines

  1. {$A+,B-,D+,E-,F-,I+,L+,N-,O-,R-,S-,V+}
  2. {$M 5000,5000,10000}
  3. program free_disk;
  4.  
  5.   uses
  6.     testfile,uupcase,dos,fdisks;
  7.  
  8.   var
  9.     s : string;
  10.     b : byte;
  11.     l : byte absolute s;
  12.  
  13.   const
  14.     summe : longint = 0;
  15.  
  16.   procedure free(ch : char);
  17.  
  18.     var
  19.       b                                : byte;
  20.       n                                : longint;
  21.  
  22.     begin
  23.       ch:=upcase(ch);
  24.       if (ch<'A') or (ch>'Z') then exit;
  25.       b:=ord(ch)-pred(ord('A'));
  26.       n:=diskfree(b);
  27.       summe:=summe+n;
  28.       writeln('Laufwerk ',ch,': ',n:12,' Bytes,',n div 1024:10,' kBytes',' frei');
  29.     end;
  30.  
  31.   begin
  32.     s:=paramstr(1);
  33.     if s='' then begin
  34.       s:=disks;
  35.       if s='' then begin
  36.         getdir(0,s);
  37.         free(s[1]);
  38.       end
  39.       else begin
  40.         for b:=1 to l do free(s[b]);
  41.         writeln('----------':24,'----------':17);
  42.         writeln('Gesammt:',summe:16,' Bytes,',summe div 1024:10,' kBytes frei');
  43.       end;
  44.     end
  45.     else free(s[1]);
  46.   end.
  47.