home *** CD-ROM | disk | FTP | other *** search
-
-
- /************************************************************/
- /* OS2SP.C */
- /* Display Disk Space Information. (OS/2) */
- /* Mark J. Lussier. */
- /* August 19, 1990. */
- /* */
- /************************************************************/
-
-
- #define INCL_DOS
-
- #include <stdio.h>
- #include <os2.h>
- #include <stdlib.h>
- #include <ctype.h>
-
- main ( INT argc, CHAR *argv[] )
- {
-
- FSALLOCATE FSInfoBuf;
- SHORT rc;
- ULONG FreeSpace, TotalSpace,UsedSpace;
- USHORT DriveSpec;
-
- printf("\n OS/2 Disk Space Checker. By Mark (c) 1990 \n\n");
-
- DriveSpec = 0;
- if ( argc > 1 )
- DriveSpec = toupper(argv[1][0]) - 64;
-
-
- if ( DriveSpec > 26 || DriveSpec < 0 )
- {
- printf("\n Invalid Drive Specification ! (Drive Letter Must be between A and Z)\n ");
- exit ( 1 );
- }
-
- rc = DosQFSInfo ( DriveSpec,
- 1,
- (PBYTE) &FSInfoBuf,
- sizeof(FSInfoBuf) );
-
- if ( rc != 0 )
- printf("\nInvalid Drive Specification!\n");
- else
- {
- if ( FSInfoBuf.ulReserved == 0 )
- printf("Standard DOS FAT File System \n\n");
- else
- printf("OS/2 High Performance File System. (HPFS)\n\n");
-
- TotalSpace = FSInfoBuf.cSectorUnit *
- FSInfoBuf.cUnit *
- FSInfoBuf.cbSector;
- FreeSpace = FSInfoBuf.cSectorUnit *
- FSInfoBuf.cUnitAvail *
- FSInfoBuf.cbSector ;
-
- UsedSpace = TotalSpace - FreeSpace;
-
- printf("Total Disk Space : %10lu Bytes, %8lu Kb, %8.1lf Megabytes\n",TotalSpace,TotalSpace/1024,(float)(TotalSpace)/1024.0/1024.0);
- printf("Disk Space Used : %10lu Bytes, %8lu Kb, %8.1lf Megabytes\n",UsedSpace,UsedSpace/1024,(float)(UsedSpace)/1024.0/1024.0);
- printf("Free Disk Space : %10lu Bytes, %8lu Kb, %8.1lf Megabytes\n",FreeSpace,FreeSpace/1024,(float)(FreeSpace)/1024.0/1024.0);
-
- printf("\n The Disk is %6.2f%% Free\n",(float)((float)(FreeSpace)/(float)(TotalSpace) * 100));
-
-
-
- }
- exit ( 0 );
- }
-