home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / EASL2PRF.ZIP / GETDISK1.INC < prev    next >
Text File  |  1990-01-30  |  3KB  |  71 lines

  1. # Gets the list of available drives and puts them in an array
  2. # We are going to assume that A: and B: are available, so we'll just
  3. # test the hard drives.
  4. application GETDRIVES
  5. string AvailDrives[26]
  6. string DrivesPot[26]
  7. integer Cnt
  8.  
  9.  
  10. subroutine GetDrives (integer:NumDrives) is
  11.    string TestDrive
  12.    integer Cnt
  13.      action InitDriveNames
  14.      copy 0 to NumDrives
  15.      start local GETDRIVES "cmd.exe"
  16.      for Cnt = 1 to 24 loop
  17.         copy "VOL " DrivesPot[Cnt] to TestDrive
  18.         send TestDrive "\n" to GETDRIVES 
  19.                 begin guarded
  20.                     response to char "SYS" from GETDRIVES
  21.                         #error message return, so drive is not there
  22.                         send input to errorlog
  23.                         leave block
  24.                     response to char "Volume in" from GETDRIVES 
  25.                         # no volume label, but disk exists
  26.                         copy (NumDrives + 1) to NumDrives
  27.                         copy DrivesPot[Cnt] to AvailDrives[NumDrives]
  28.                         send input "\n" to errorlog
  29.                         send Cnt DrivesPot[Cnt] "\n" to errorlog
  30.                         leave block
  31.                     response to char "The volume label in" from GETDRIVES 
  32.                         # volume has a label, so disk exists
  33.                         copy (NumDrives + 1) to NumDrives
  34.                         copy DrivesPot[Cnt] to AvailDrives[NumDrives]
  35.                         send input "\n" to errorlog
  36.                         send Cnt DrivesPot[Cnt] "\n" to errorlog
  37.                         leave block
  38.                     response to line from GETDRIVES 
  39.                         # volume has a label, so disk exists
  40.                         send input "\n" to errorlog
  41.                 end
  42.      end loop
  43.  
  44. action InitDriveNames is
  45.   copy "C:" to DrivesPot[1]
  46.   copy "D:" to DrivesPot[2]
  47.   copy "E:" to DrivesPot[3]
  48.   copy "F:" to DrivesPot[4]
  49.   copy "G:" to DrivesPot[5]
  50.   copy "H:" to DrivesPot[6]
  51.   copy "I:" to DrivesPot[7]
  52.   copy "J:" to DrivesPot[8]
  53.   copy "K:" to DrivesPot[9]
  54.   copy "L:" to DrivesPot[10]
  55.   copy "M:" to DrivesPot[11]
  56.   copy "N:" to DrivesPot[12]
  57.   copy "O:" to DrivesPot[13]
  58.   copy "P:" to DrivesPot[14]
  59.   copy "Q:" to DrivesPot[15]
  60.   copy "R:" to DrivesPot[16]
  61.   copy "S:" to DrivesPot[17]
  62.   copy "T:" to DrivesPot[18]
  63.   copy "U:" to DrivesPot[19]
  64.   copy "V:" to DrivesPot[20]
  65.   copy "W:" to DrivesPot[21]
  66.   copy "X:" to DrivesPot[22]
  67.   copy "Y:" to DrivesPot[23]
  68.   copy "Z:" to DrivesPot[24]
  69.                 
  70.  
  71.