home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / EDGE1_704.DMS / in.adf / ExtraStuff / Edge_MoreRexx.lha / EdgeLog.edge < prev    next >
Encoding:
Text File  |  1993-10-22  |  2.1 KB  |  89 lines

  1. /*
  2. ** $VER: EdgeLog.edge 1.3 (Sunday 08-Aug-93 02:47:08)
  3. **
  4. ** Log changes made to the files in Edge, _FE_User7 is used as 'changed flag'.
  5. ** F1 in _FE_UserFlags is used as log-file enable flag.
  6. ** You may specify the delay between each snapshot, if not given a delay of 6 minutes will be used
  7. ** Once this program is started it will stay in the background untill stopped by 'hi', e.g you 
  8. ** don't have to restart it when you restart Edge. 
  9. **
  10. ** Written by Thomas liljetoft
  11. */
  12.  
  13. options results
  14.  
  15. arg delay
  16.  
  17. if length(delay) = 0 then delay = 6
  18.  
  19. /* enter the main loop, to exit this you must use 'HI' */
  20. do forever
  21.  
  22.     /* check if Edge is present */
  23.     if show('p','EDGE') ~= 0 then
  24.         do
  25.  
  26.         address 'EDGE'
  27.  
  28.         /* get the address of the first file,
  29.            if this fails the editor is very likely dormant, so don't do anything */
  30.  
  31.         'addressof' top
  32.         if RC = 0 then
  33.             do    
  34.             first = result
  35.             this = first
  36.  
  37.             /* get current date and time */
  38.             'getenvvar' _ge_date
  39.             timestamp = result
  40.  
  41.             /* set current directory to that of Edge */
  42.             'getenvvar' _ge_currentdir
  43.             call pragma(d,result)
  44.  
  45.             /* scan through all files and log changes */
  46.             do forever
  47.                 address value this
  48.  
  49.                 /* create log file for this file ?*/
  50.                 'flag' _fe_userflags f1
  51.                 if result = 'Set' then
  52.                     do
  53.  
  54.                     /* get full name of file */
  55.                     'getenvvar' _fe_dosname
  56.                     filename = result
  57.                     
  58.                     /* get filesize, lines and changes */
  59.                     'getenvvar' _fe_size
  60.                     filesize = result
  61.                     'getenvvar' _fe_lines
  62.                     filelines = result
  63.                     'getenvvar' _fe_changes
  64.                     filechanges = result
  65.                 
  66.                     /* add info to log file if file has changed since last check */
  67.                     'getenvvar' _fe_user7
  68.  
  69.                     if result ~= filesize','filelines','filechanges then
  70.                         do
  71.                         address command 'echo >>'filename'.edlog' '"DATE *"'timestamp'*" SIZE 'filesize' LINES 'filelines' CHANGES 'filechanges'"'
  72.                         'putenvvar' _fe_user7 '"'filesize','filelines','filechanges'"'
  73.                         end
  74.  
  75.                     end
  76.  
  77.                 /* get the address of the next file */
  78.                 'addressof' next
  79.                 this = result
  80.                 if this = first then leave
  81.             end
  82.         end
  83.     end
  84.  
  85.     address command wait delay min    /* go to sleep until next snapshot */
  86.  
  87. end
  88.  
  89.