home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / srcmac.zip / CHECKOUT.REX < prev    next >
OS/2 REXX Batch file  |  1994-05-10  |  2KB  |  43 lines

  1. /* CHECKOUT.CMD - Checks the current SourceLink file out of SourceSafe */
  2.  
  3. 'S_SAVE_POS'                                            /* Save off current position in file */
  4.  
  5. 'S_GET_BUFF_FILENAME' 0 OrigName                        /* Get current file name */
  6.  
  7. 'S_CLOSE_SL_FILE' 0                                     /* Close the current file */
  8.  
  9. /* Change directory to the directory of the current SourceLink file */
  10.  
  11. LastSlashPos = LASTPOS('\',OrigName)                    /* Find the position of last slash */
  12. PathName = LEFT(OrigName,LastSlashPos-1)                /* Trim off filename at the end of the string */
  13. 's_cd "'PathName'"'                                     /* Change directory to current file directory */
  14.  
  15. NoDriveName = RIGHT(OrigName,LENGTH(OrigName)-2)        /* Strip off the drive: from the name */
  16.  
  17. 'S_OPEN_SL_FILE 1 E Y TEMP.TMP'                         /* Open a temp file in SourceLink */
  18.  
  19. 'S_INSERT_LINE   '                                      /* Put out wait message */
  20. 'S_INSERT_LINE   '
  21. 'S_INSERT_LINE               Please wait while SourceSafe retrieves your file.'
  22.  
  23. 'l:\ss\os2\ss checkout' NoDriveName '2> out.out'        /* Ask SourceSafe to check out the name into current dir */
  24.  
  25. IF rc \= 0 THEN DO
  26.    ErrorCode = rc
  27.    
  28.    'S_OPEN_SL_FILE 0 R N' out.out                       /* Have SourceLink show the error file */
  29.    
  30.    'S_MSG SourceSafe got an error:,' ErrorCode ',,' UserResult  /* Report error to user */
  31.  
  32.    'S_CLOSE_SL_FILE' 0                                  /* Close the error file */
  33. END
  34.  
  35. 'del out.out'                                           /* Delete SourceSafe output file */
  36.  
  37. 'S_CLOSE_SL_FILE' 0                                     /* Close the wait message file */
  38.  
  39. 'del temp.tmp'                                          /* Delete temp file */
  40.  
  41. 'S_OPEN_SL_FILE 0 D N' OrigName                         /* Have SourceLink edit the checked out file */
  42.  
  43. 'S_GOTO_POS'                                            /* Go back to saved position */