home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / sema4.zip / semaphor / threads / swapinfo.cmd
OS/2 REXX Batch file  |  1994-02-17  |  1KB  |  47 lines

  1. ARG window, swapid
  2.  
  3. /* Do while a semaphore event is posted (equal to 1) */
  4. do while 1
  5.    /* Indefinite wait for an event to be posted */
  6.    rc=VpSemaphore("EVENT","WAITREQUEST",SWAPID,-1)
  7.  
  8.    /* Get the current drive application variable */
  9.    current_drive=VPAppVariable("GET","CDRIVE")
  10.  
  11.    /* Find and display information for the current drive */
  12.    result= sysdriveinfo(current_drive)
  13.    parse var result drive free size label
  14.    /* Set item value  Text */
  15.    CALL VpSetItemValue window,1007,strip(label)
  16.    /* Set item value  Text */
  17.    CALL VpSetItemValue window,1008,size
  18.    /* Set item value  Text */
  19.    CALL VpSetItemValue window,1009,free
  20.    avail = format(100*(free/size),,0)
  21.    /* Set item value  Text */
  22.    CALL VpSetItemValue window,1017,avail'%'
  23.  
  24.    /* FIND SWAPPER.DAT INFO */
  25.    os_drive=VPAppVariable("GET","OSDRIVE")
  26.    CALL SysFileSearch 'SWAPPATH', os_drive'\config.sys','swap.'
  27.    i=swap.0
  28.    IF i='' THEN
  29.       /* Set item value  Text */
  30.       CALL VpSetItemValue window,1011,'Not Found'
  31.    ELSE DO
  32.       parse var swap.i . '=' swappath .
  33.       if right(swappath,1)='\' then
  34.          swappath=strip(swappath,'t','\')
  35.       call sysfiletree swappath||'\swapper.dat','file'
  36.       i=file.0
  37.       parse var file.i . . value .
  38.       /* Set item value  Text */
  39.       CALL VpSetItemValue window,1011,value
  40.       END
  41.  
  42.    /* Reset the EVENT semaphore to 0 */
  43.    rc=VpSemaphore("EVENT","RESET",SWAPID)
  44.    END
  45.  
  46.  
  47.