home *** CD-ROM | disk | FTP | other *** search
- /* Edge macro: hn_addversion
- **
- ** $VER: hn_addversion.edge 1.1 (16-Feb-93 01:03:23)
- **
- ** Usage: hn_addversion [UPDATE]
- **
- ** Synopsis: Insert a version string at current cursor position,
- ** based on current date and filename, position the cursor
- ** so the user may type the version.revision
- **
- ** Authors: Written by Henrik Nordström
- ** Based on AddVersion by Thomas liljetoft
- **
- ** Changes: Removed day of week from datestring
- ** 'addversion update' updates datestring
- ** RAW flag on 'text' for optimized output
- ** cleaner calling of editor commands
- **
- ** ToDO: Automatic revision=revision+1 on UPDATE
- */
-
- options results
-
- parse upper arg updateflag
- if updateflag='UPDATE' | updateflag='1' then updateflag=1
- else updateflag=0
-
- /* first get filename and date */
-
- 'getenvvar _fe_name'
- filename = result
-
- 'getenvvar _ge_Date'
- timestamp=result
- parse var timestamp . ' ' timestamp
-
- /* insert the version string, put the cursor after the filename */
- if updateflag then do
- 'find "$VER: 'filename'" words 0 circular 1'
- if rc=0 then do
- 'find "(" forward 1 words 0'
- 'cursor right 1'
- 'blockoff'
- 'markblock'
- 'find ")" forward 1 words 0'
- 'erase'
- 'blockoff'
- 'text "'timestamp'" RAW'
- end
- else updateflag=0 /* No version-string to update... */
- end
- if ~updateflag then
- 'text "$VER: 'filename' 1.0 ('timestamp')" RAW'
- 'find " (" forward 0 words 0'
- exit(0)
-