home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / srcmac.zip / GETWLCK.REX < prev    next >
OS/2 REXX Batch file  |  1993-01-14  |  2KB  |  73 lines

  1. /* GETWLCK.REC - PVCS GET current file With LoCK
  2.  
  3.   This macro GETs the current file that you are viewing from the logfile
  4.   and locks the logfile.
  5.  
  6.   Customizations necessary:
  7.   1. PVCSGET specs where the GET executable is.
  8.   2. sLogFile is the directory where your log file in question is.
  9.      Remember the final '\'.
  10. */
  11.  
  12. /* -------------------------- Alias list ----------------------------*/
  13.  
  14.       /* GET */
  15. PVCSGET = 'e:\pvcs\get'
  16.  
  17.       /* The directory path where the logfile can be found */
  18. sLogFile = 'e:\pvcs\macros\test\src\'
  19.  
  20. /* ---------------------------- Begin ------------------------------ */
  21.  
  22.      /* Get the current file */
  23. 's_get_curr_filename sCurrFile'
  24.  if \(RC = 0) then
  25.    do
  26.    's_msg "Could not obtain the current file name","Error Code is:",' rc ',resp'
  27.    exit
  28.    end
  29.  
  30.   /* Build all strings we will use about the work file and log file. */   
  31.   sDrv = filespec("drive",sCurrFile)
  32.   sFileName = filespec("name",sCurrFile)
  33.   sPath = filespec("path",sCurrFile)
  34.   
  35.   iLp = lastpos('.',sFileName)
  36.   sNameOnly = substr(sFileName,1,iLp-1)
  37.   
  38.   iLp = lastpos('.',sCurrFile)
  39.   sExtension = substr(sCurrFile,iLp+1)
  40.   
  41.   /* Make the extension into PVCS standard form, adding a 'V' in the 3rd position */
  42.   if (length(sExtension) = 1) then
  43.     sLFExt = insert(sExtension,'_V')
  44.   else if (length(sExtension) = 2) then
  45.      sLFExt = insert(sExtension,'V')
  46.   else if (length(sExtension) = 3) then
  47.     sLFExt = overlay('V',sExtension,3)
  48.   else
  49.     sLFExt = '__V'
  50.   
  51.   /* Build the logfile name */
  52.   sLogFile = insert(sLogFile,sNameOnly)
  53.   sLogFile = insert(sLogFile,'.')
  54.   sLogFile = insert(sLogFile,sLFExt)
  55.       
  56.   
  57.   cmd = pvcsget '-l -q -xeerr' sLogFile
  58.   cmd
  59.  
  60.   /* If the command to do the get failed, give the user the ERR file */
  61.   if \(rc=0) then
  62.     do
  63.     's_msg "GET failed, error code is:",' rc ',,resp'
  64.     'slstart err'
  65.     end
  66.   else
  67.     do
  68.       's_close_curr_file'
  69.       's_open_sl_file 0 E N' sCurrFile
  70.       's_msg "GET w/Lock succeeded",,,resp'
  71.     end
  72.  
  73. /* fini */