home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Editor / Edge1721.DMS / Edge1721.adf / ExtraStuff / Edge_SasC.lha / rexx / hn_addversion.edge < prev    next >
Encoding:
Text File  |  1993-11-09  |  1.4 KB  |  56 lines

  1. /* Edge macro: hn_addversion
  2. **
  3. ** $VER: hn_addversion.edge 1.1 (16-Feb-93 01:03:23)
  4. ** 
  5. ** Usage:    hn_addversion [UPDATE]
  6. **
  7. ** Synopsis: Insert a version string at current cursor position,
  8. **           based on current date and filename, position the cursor
  9. **           so the user may type the version.revision
  10. **
  11. ** Authors:  Written by Henrik Nordström
  12. **           Based on AddVersion by Thomas liljetoft
  13. **
  14. ** Changes:  Removed day of week from datestring
  15. **           'addversion update' updates datestring
  16. **           RAW flag on 'text' for optimized output
  17. **           cleaner calling of editor commands
  18. **
  19. ** ToDO:     Automatic revision=revision+1 on UPDATE
  20. */
  21.  
  22. options results
  23.  
  24. parse upper arg updateflag
  25. if updateflag='UPDATE' | updateflag='1' then updateflag=1
  26. else updateflag=0
  27.  
  28. /* first get filename and date */
  29.  
  30. 'getenvvar _fe_name'
  31. filename = result
  32.  
  33. 'getenvvar _ge_Date'
  34. timestamp=result
  35. parse var timestamp . ' ' timestamp
  36.  
  37. /* insert the version string, put the cursor after the filename */
  38. if updateflag then do
  39.     'find "$VER: 'filename'" words 0 circular 1'
  40.     if rc=0 then do
  41.         'find "(" forward 1 words 0'
  42.         'cursor right 1'
  43.         'blockoff'
  44.         'markblock'
  45.         'find ")" forward 1 words 0'
  46.         'erase'
  47.         'blockoff'
  48.         'text "'timestamp'" RAW'
  49.     end
  50.         else updateflag=0    /* No version-string to update... */
  51. end
  52. if ~updateflag then
  53.     'text "$VER: 'filename' 1.0 ('timestamp')" RAW'
  54. 'find " (" forward 0 words 0'
  55. exit(0)
  56.