home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
pmcstex.zip
/
install
/
advanced
/
BackupFiles
/
backup-files.diff
Wrap
Text File
|
2000-04-09
|
6KB
|
160 lines
--- e3emul.e Tue Mar 12 14:10:42 1996
+++ e3emul-new.e Sun Apr 9 19:26:16 2000
@@ -492,6 +492,9 @@
compile if BACKUP_PATH <> '' & BACKUP_PATH <> '='
universal backup_path_ok
compile endif
+compile if BACKUP_PATH <> ''
+ universal backup_extensions, backup_enabled
+compile endif
-- prepare given arguments for use
parse value given_name with name '[' fto ']'
options=arg(2)
@@ -538,6 +541,8 @@
compile if BACKUP_PATH
-- jbl 1/89 new feature. Editors in the real marketplace keep at least
-- one backup copy when a file is written.
+ if backup_enabled and (backup_extensions=='' or wordpos(filetype(name),backup_extensions))
+ then
compile if BACKUP_PATH <> '='
if backup_path_ok then
compile endif
@@ -549,6 +554,7 @@
compile if BACKUP_PATH <> '='
endif
compile endif
+ endif
compile endif
'xcom s 'options name; src=rc -- the save code for a vanilla PC file...
compile if EVERSION >= '5.50' --@HPFS
--- saveload.e Tue Oct 3 13:20:32 1995
+++ saveload-new.e Sun Apr 9 19:24:58 2000
@@ -19,6 +19,7 @@
HOSTCOPYOPTIONS= '' -- Any options you want appended to the HOSTCOPY
compile endif -- command. E.g., for CP78COPY, you might want '/Q'.
+
defproc loadfile(files,options)
universal hostfileid,hostfilespec
@@ -48,7 +49,10 @@
endif
defproc savefile(name)
-compile if EVERSION >= '5.50' --@HPFS
+compile if BACKUP_PATH <> ''
+ universal backup_extensions, backup_enabled
+compile endif
+.compile if EVERSION >= '5.50' --@HPFS
name_same = (name = .filename)
compile endif
options = check_for_printer(name) -- Returns 0 or printer number.
@@ -62,6 +66,8 @@
return 0 /* Return 0, some terminal emulators do not give us */
compile if BACKUP_PATH
else
+ if backup_enabled and (backup_extensions=='' or wordpos(filetype(name),backup_extensions))
+ then
compile if EVERSION >= '5.50' --@HPFS
if pos(' ',name) & leftstr(name,1)<>'"' then
name = '"'name'"'
@@ -74,6 +80,7 @@
compile else
quietshell 'copy' name MakeBakName() '>nul'
compile endif
+ endif
compile endif
endif /* meaningful error codes. */
compile if BACKUP_PATH = '' & EVERSION >= '5.50' --@HPFS
--- slnohost.e Tue Oct 3 13:20:30 1995
+++ slnohost-new.e Sun Apr 9 19:25:06 2000
@@ -11,6 +11,9 @@
'xcom e 'options files
defproc savefile(name)
+compile if BACKUP_PATH <> ''
+ universal backup_extensions, backup_enabled
+compile endif
src = check_for_printer(name) -- Returns 0 or printer number.
if src then -- If a printer (i.e., non-zero),
if not printer_ready(src) then -- and it's not ready,
@@ -27,11 +30,14 @@
-- jbl 1/89 new feature. Editors in the real marketplace keep at least
-- one backup copy when a file is written.
compile if BACKUP_PATH
+ if backup_enabled and (backup_extensions=='' or wordpos(filetype(name),backup_extensions))
+ then
compile if EVERSION >= '4.10' -- OS/2 - redirect STDOUT & STDERR
quietshell 'copy' name MakeBakName() '1>nul 2>nul'
compile else
quietshell 'copy' name MakeBakName() '>nul'
compile endif
+ endif
compile endif
endif
'xcom s 'arg(2) name; src=rc
--- stdprocs.e Wed Apr 22 15:48:18 1998
+++ stdprocs-new.e Sun Apr 9 20:20:58 2000
@@ -4,7 +4,6 @@
Note: my changes are tagged by //PM
*/
-
compile if EVERSION >= 4 & EVERSION < '5.51' -- 5.51 & above define this internally.
defproc address(var varname) =
return selector(varname) || offset(varname)
@@ -651,6 +650,35 @@
endif
compile endif
+/* backup_extensions: make backup file for files with only the extension given
+ below (if this is empty, then for all files)
+ backup_enabled: switched this variable to 0 in order to disable file backup
+
+ The following two routines can be used to set those variables (from
+ Profile.erx, for instance):
+ set_backup_extensions('_extensions_');
+ backup_enable( [0|1] );
+ Petr Mikulik, April 2000
+*/
+compile if BACKUP_PATH <> ''
+DEFINIT
+ universal backup_extensions, backup_enabled
+-- backup_extensions=''
+backup_extensions=TEX_EXTENSIONS ' AWK ASM BIB C CC CPP E F GP H HTM HTML JAVA M PAS'
+backup_enabled=1
+compile endif
+
+-- two set backup routines added by Petr Mikulik, April 2000
+compile if BACKUP_PATH <> ''
+defc set_backup_extensions =
+ universal backup_extensions
+ backup_extensions=upcase(arg(1))
+
+defc backup_enable =
+ universal backup_enabled
+ if arg(1)='0' then backup_enabled=0;
+ else backup_enabled=1; endif
+compile endif
compile if BACKUP_PATH <> ''
; Procedure to pick a filename for backup purposes, like STDPROCS.E$.
@@ -660,12 +688,12 @@
name = .filename
endif
-- Change name as little as possible, but enough to identify it as
- -- a noncritical file. Replace the last character with '$'.
- ext = filetype(name)
- if length(ext)=3 then
- ext = substr(ext,1,2)'$'
+ -- a noncritical file. Replace the last character with '~'.
+ ext = filetype(name) -- don't use ext below, since it is uppercase //PM 5.4.2000
+ if length(ext)>=3 then
+ ext = substr(name,length(name)-length(ext)+1,2)'~'
else
- ext = ext'$'
+ ext = substr(name,length(name)-length(ext)+1,length(ext))'~'
endif
-- We still use MakeTempName() for its handling of host names.
bakname = MakeTempName(name)