home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / EASL2PRF.ZIP / GETDISK.OLD < prev    next >
Text File  |  1990-02-20  |  2KB  |  75 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. include fileio.inc
  6.  
  7.  
  8. fileid FileID
  9. string AvailDrives[26]
  10. string DrivesPot[26]
  11. string Access is "write"
  12. string FileNameTemp GetDriveParms InitMsg
  13. integer Cnt
  14.  
  15.  
  16. subroutine GetDrives (integer:NumDrives) is
  17.      set pointer to SPTR_WAIT
  18.      action InitDriveNames
  19.      copy "Loading, please wait\nā–ˆ" to InitMsg
  20.      change InitializeST text to InitMsg
  21.      copy 0 to NumDrives
  22.      start local GETDRIVES "CMD.EXE"  
  23.      for Cnt = 1 to 24 loop
  24.         copy DrivesPot[Cnt] "\\$$$XX.$$$" to FileNameTemp
  25.         call Open(FileID, FileNameTemp, Access)
  26.         if (errorlevel > 0) then 
  27.                 #drive must not exist
  28.                 call Close(FileID)
  29.         else
  30.                 #drive must exist
  31.                 append "ā–ˆ" to InitMsg
  32.                 change InitializeST text to InitMsg
  33.                 call Close(FileID)
  34.                 copy (NumDrives + 1) to NumDrives
  35.                 copy DrivesPot[Cnt] to AvailDrives[NumDrives]
  36.                 copy "DYNCMD.CMD ERASE " FileNameTemp "\n" to GetDriveParms 
  37.                 send GetDriveParms to GETDRIVES
  38.                    begin guarded 
  39.                        response to line "ALL DONE" from GETDRIVES 
  40.                             leave block
  41.                        response to line from GETDRIVES 
  42.                           # do nothing
  43.                    end
  44.         end if
  45.      end loop
  46.      set pointer to SPTR_ARROW
  47.  
  48. action InitDriveNames is
  49.   copy "C:" to DrivesPot[1]
  50.   copy "D:" to DrivesPot[2]
  51.   copy "E:" to DrivesPot[3]
  52.   copy "F:" to DrivesPot[4]
  53.   copy "G:" to DrivesPot[5]
  54.   copy "H:" to DrivesPot[6]
  55.   copy "I:" to DrivesPot[7]
  56.   copy "J:" to DrivesPot[8]
  57.   copy "K:" to DrivesPot[9]
  58.   copy "L:" to DrivesPot[10]
  59.   copy "M:" to DrivesPot[11]
  60.   copy "N:" to DrivesPot[12]
  61.   copy "O:" to DrivesPot[13]
  62.   copy "P:" to DrivesPot[14]
  63.   copy "Q:" to DrivesPot[15]
  64.   copy "R:" to DrivesPot[16]
  65.   copy "S:" to DrivesPot[17]
  66.   copy "T:" to DrivesPot[18]
  67.   copy "U:" to DrivesPot[19]
  68.   copy "V:" to DrivesPot[20]
  69.   copy "W:" to DrivesPot[21]
  70.   copy "X:" to DrivesPot[22]
  71.   copy "Y:" to DrivesPot[23]
  72.   copy "Z:" to DrivesPot[24]
  73.                 
  74.  
  75.