home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / OS2UTIL.ZIP / WFRE.C < prev    next >
Text File  |  1990-05-21  |  1KB  |  47 lines

  1. #define INC_SUB 1
  2.  
  3. #include "os2.h"
  4. #include "stdio.h"
  5. #include "ctype.h"
  6. #include "stdlib.h"
  7.  
  8. int main(int argc, char* *argv);
  9.  
  10. main(argc, argv)
  11. int argc;
  12. char **argv;
  13. {
  14.     USHORT usDisk;
  15.     ULONG usLogicalDriveMap;
  16.     FSALLOCATE FSInfoBuf;
  17.  
  18.     if (argc > 1)
  19.         usDisk = toupper(argv[1][0]) - '@';
  20.  
  21.     if (argc == 1 || usDisk < 1 || usDisk > 26)
  22.        DosQCurDisk(&usDisk, &usLogicalDriveMap);
  23.  
  24.  
  25.  
  26.     printf("\nDrive   total bytes      bytes used       ");
  27.     puts("available  capacity  cluster size");
  28.  
  29.     if (DosQFSInfo(usDisk, 1, (PBYTE) &FSInfoBuf, sizeof(FSInfoBuf))) {
  30.        printf(" %c:", usDisk + '@');
  31.        puts("    ....Bad Drive Specifier....");
  32.        exit(1);
  33.     }
  34.     else
  35.     {
  36.        printf(" %c:", usDisk + '@');
  37.        printf("     %11lu      %10lu      ",
  38.            FSInfoBuf.cSectorUnit*FSInfoBuf.cUnit*FSInfoBuf.cbSector,
  39.            FSInfoBuf.cSectorUnit*(FSInfoBuf.cUnit-FSInfoBuf.cUnitAvail)*FSInfoBuf.cbSector);
  40.        printf("%10lu   %6.2f%%          %4d\n",
  41.            FSInfoBuf.cSectorUnit*FSInfoBuf.cUnitAvail*FSInfoBuf.cbSector,
  42.            100.0*(FSInfoBuf.cUnit-FSInfoBuf.cUnitAvail)/FSInfoBuf.cUnit,
  43.            FSInfoBuf.cSectorUnit*FSInfoBuf.cbSector);
  44.     }
  45.     return(0);
  46. }
  47.