home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / pmcstex.zip / install / advanced / BackupFiles / backup-files.diff
Text File  |  2000-04-09  |  6KB  |  160 lines

  1. --- e3emul.e    Tue Mar 12 14:10:42 1996
  2. +++ e3emul-new.e    Sun Apr  9 19:26:16 2000
  3. @@ -492,6 +492,9 @@
  4.  compile if BACKUP_PATH <> '' & BACKUP_PATH <> '='
  5.     universal backup_path_ok
  6.  compile endif
  7. +compile if BACKUP_PATH <> ''
  8. +  universal    backup_extensions, backup_enabled
  9. +compile endif
  10.                                               -- prepare given arguments for use
  11.     parse value given_name with name '[' fto ']'
  12.     options=arg(2)
  13. @@ -538,6 +541,8 @@
  14.  compile if BACKUP_PATH
  15.         -- jbl 1/89 new feature.  Editors in the real marketplace keep at least
  16.         -- one backup copy when a file is written.
  17. + if backup_enabled and (backup_extensions=='' or wordpos(filetype(name),backup_extensions))
  18. + then
  19.   compile if BACKUP_PATH <> '='
  20.     if backup_path_ok then
  21.   compile endif
  22. @@ -549,6 +554,7 @@
  23.   compile if BACKUP_PATH <> '='
  24.     endif
  25.   compile endif
  26. + endif
  27.  compile endif
  28.     'xcom s 'options name; src=rc    -- the save code for a vanilla PC file...
  29.  compile if EVERSION >= '5.50'  --@HPFS
  30. --- saveload.e    Tue Oct  3 13:20:32 1995
  31. +++ saveload-new.e    Sun Apr  9 19:24:58 2000
  32. @@ -19,6 +19,7 @@
  33.     HOSTCOPYOPTIONS= ''     -- Any options you want appended to the HOSTCOPY
  34.  compile endif              -- command.  E.g., for CP78COPY, you might want '/Q'.
  35.  
  36. +
  37.  defproc loadfile(files,options)
  38.     universal hostfileid,hostfilespec
  39.  
  40. @@ -48,7 +49,10 @@
  41.     endif
  42.  
  43.  defproc savefile(name)
  44. -compile if EVERSION >= '5.50'  --@HPFS
  45. +compile if BACKUP_PATH <> ''
  46. +  universal    backup_extensions, backup_enabled
  47. +compile endif
  48. +.compile if EVERSION >= '5.50'  --@HPFS
  49.     name_same = (name = .filename)
  50.  compile endif
  51.     options = check_for_printer(name)    -- Returns 0 or printer number.
  52. @@ -62,6 +66,8 @@
  53.        return 0      /* Return 0, some terminal emulators do not give us */
  54.  compile if BACKUP_PATH
  55.     else
  56. +   if backup_enabled and (backup_extensions=='' or wordpos(filetype(name),backup_extensions))
  57. +   then
  58.   compile if EVERSION >= '5.50'  --@HPFS
  59.        if pos(' ',name) & leftstr(name,1)<>'"' then
  60.           name = '"'name'"'
  61. @@ -74,6 +80,7 @@
  62.   compile else
  63.        quietshell 'copy' name MakeBakName() '>nul'
  64.   compile endif
  65. +   endif
  66.  compile endif
  67.     endif            /* meaningful error codes.                          */
  68.  compile if BACKUP_PATH = '' & EVERSION >= '5.50'  --@HPFS
  69. --- slnohost.e    Tue Oct  3 13:20:30 1995
  70. +++ slnohost-new.e    Sun Apr  9 19:25:06 2000
  71. @@ -11,6 +11,9 @@
  72.     'xcom e 'options files
  73.  
  74.  defproc savefile(name)
  75. +compile if BACKUP_PATH <> ''
  76. +  universal    backup_extensions, backup_enabled
  77. +compile endif
  78.     src = check_for_printer(name)        -- Returns 0 or printer number.
  79.     if src then                          -- If a printer (i.e., non-zero),
  80.        if not printer_ready(src) then    -- and it's not ready,
  81. @@ -27,11 +30,14 @@
  82.        -- jbl 1/89 new feature.  Editors in the real marketplace keep at least
  83.        -- one backup copy when a file is written.
  84.  compile if BACKUP_PATH
  85. + if backup_enabled and (backup_extensions=='' or wordpos(filetype(name),backup_extensions))
  86. + then
  87.   compile if EVERSION >= '4.10'    -- OS/2 - redirect STDOUT & STDERR
  88.        quietshell 'copy' name MakeBakName() '1>nul 2>nul'
  89.   compile else
  90.        quietshell 'copy' name MakeBakName() '>nul'
  91.   compile endif
  92. + endif
  93.  compile endif
  94.     endif
  95.     'xcom s 'arg(2) name; src=rc
  96. --- stdprocs.e    Wed Apr 22 15:48:18 1998
  97. +++ stdprocs-new.e    Sun Apr  9 20:20:58 2000
  98. @@ -4,7 +4,6 @@
  99.  Note: my changes are tagged by  //PM
  100.  */
  101.  
  102. -
  103.  compile if EVERSION >= 4 & EVERSION < '5.51'  -- 5.51 & above define this internally.
  104.  defproc address(var varname) =
  105.     return selector(varname) || offset(varname)
  106. @@ -651,6 +650,35 @@
  107.     endif
  108.  compile endif
  109.  
  110. +/* backup_extensions: make backup file for files with only the extension given 
  111. +   below (if this is empty, then for all files)
  112. +   backup_enabled: switched this variable to 0 in order to disable file backup
  113. +
  114. +   The following two routines can be used to set those variables (from 
  115. +   Profile.erx, for instance):
  116. +    set_backup_extensions('_extensions_');
  117. +    backup_enable( [0|1] );
  118. +  Petr Mikulik, April 2000
  119. +*/
  120. +compile if BACKUP_PATH <> ''
  121. +DEFINIT
  122. +  universal    backup_extensions, backup_enabled
  123. +-- backup_extensions=''
  124. +backup_extensions=TEX_EXTENSIONS ' AWK ASM BIB C CC CPP E F GP H HTM HTML JAVA M PAS'
  125. +backup_enabled=1
  126. +compile endif
  127. +
  128. +-- two set backup routines added by Petr Mikulik, April 2000
  129. +compile if BACKUP_PATH <> ''
  130. +defc set_backup_extensions =
  131. +  universal backup_extensions
  132. +  backup_extensions=upcase(arg(1))
  133. +
  134. +defc backup_enable =
  135. +  universal backup_enabled
  136. +  if arg(1)='0' then backup_enabled=0;
  137. +    else backup_enabled=1; endif
  138. +compile endif
  139.  
  140.  compile if BACKUP_PATH <> ''
  141.  ;  Procedure to pick a filename for backup purposes, like STDPROCS.E$.
  142. @@ -660,12 +688,12 @@
  143.        name = .filename
  144.     endif
  145.     -- Change name as little as possible, but enough to identify it as
  146. -   -- a noncritical file.  Replace the last character with '$'.
  147. -   ext = filetype(name)
  148. -   if length(ext)=3 then
  149. -      ext = substr(ext,1,2)'$'
  150. +   -- a noncritical file.  Replace the last character with '~'.
  151. +   ext = filetype(name) -- don't use ext below, since it is uppercase //PM 5.4.2000
  152. +   if length(ext)>=3 then
  153. +      ext = substr(name,length(name)-length(ext)+1,2)'~'
  154.     else
  155. -      ext = ext'$'
  156. +      ext = substr(name,length(name)-length(ext)+1,length(ext))'~'
  157.     endif
  158.     -- We still use MakeTempName() for its handling of host names.
  159.     bakname = MakeTempName(name)
  160.