home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
epmsmp.zip
/
REVERT.E
< prev
next >
Wrap
Text File
|
1992-09-01
|
1KB
|
46 lines
; Revert to saved - throw away changes and reload from disk.
; The following command will throw away any changes made to a file since
; the last time it was loaded from disk, and reload the saved copy. It
; does nothing if the file doesn't exist on disk.
; by Larry Margolis
compile if not defined(HOST_SUPPORT)
tryinclude 'mycnf.e'
compile if not defined(HOST_SUPPORT)
const
HOST_SUPPORT = 'STD'
compile endif
defmain
'revert'
compile endif
defc revert =
compile if HOST_SUPPORT
if not exist(.filename) & not check_for_host_file(.filename) then
compile else
if not exist(.filename) then
compile endif
sayerror .filename 'does not exist on disk; nothing to revert to.'
return sayerror("File not found")
endif
if .modify then
if askyesno('Throw away changes to' .filename'?')<>'Y' then
return -293 -- sayerror("has been modified")
endif
endif
getfileid startfid
'e /d =' -- /D means load from disk even if in ring.
getfileid newfid -- Remember the new fileid.
if rc = sayerror("new file") then -- (Host) File not found
'quit' -- Don't throw away what we had.
elseif newfid<>startfid then -- If we got something new...
activatefile startfid
.modify = 0
'quit'
activatefile newfid
endif