home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / steward8.zip / Lock.cmd < prev    next >
OS/2 REXX Batch file  |  1996-04-03  |  796b  |  35 lines

  1. /* ------------------------------------------------------------------ */
  2. /*
  3.  * Lock
  4.  *
  5.  * Lock this file from other Steward processes
  6.  *
  7.  */
  8.  
  9. TRUE = 1
  10. FALSE = 0
  11.  
  12. Lock: 
  13.  
  14. parse arg FileName
  15.  
  16. /* first open the lock file */
  17. LockName = FileName.'lock'
  18. rc = stream(LockName, 'C', 'OPEN')
  19.  
  20. /* Make sure we loop until we can open the lock file */
  21. parse var rc state ':' code
  22. /* We only loop for a 32 code which means someone else has it open */
  23. do while state = 'NOTREADY' & code = '32'
  24.   call SysSleep 1
  25.   rc = stream(LockName, 'C', 'OPEN')
  26.   parse var rc state ':'
  27.   end
  28.  
  29. /* Make sure we actually opened it and didn't get an error message */
  30. if state <> 'READY' then return FALSE
  31.  
  32. return TRUE
  33.  
  34. /* ------------------------------------------------------------------ */
  35.