EUG PD
1st April 1995Categories: Description: Utility
Author: Ross Little
Published in EUG #19
The program Safe, is a utility for ADFS users to prevent them from overwriting files accidentally. It can only operate on ADFS with PAGE set at &1D00 as it reads the RAM directly. In addition, it will only protect against overwriting programs in the Currrently Selected Directory. Pathnames are not protected, even if they lead to the current directory. The program is intended to be copied to your workdisks, and maybe put in a !BOOT file. Because the routine intercepts the OSFILE routine, which saves a complete file, it won't just stop at the BASIC 'SAVE' command; it will also protect against the '*SAVE' command, and even extend into View and most other interfaces.
To use the routine, you should enter it by typing *SAFE at the prompt with the appropriate disk in the drive. When entered, it will change certain machine vectors and display an introductory message. From then on, you can use your normal save commands, and will not be informed of its presence. Unless, that is, a file you are trying to save already exists.
A point to note is that, when it is not compulsory, quotation marks around filenames must not be used. It is for this reason that I have also intercepted the *HELP command. When this (or an abbreviation) is typed, the first item will be assurance that the SAFE routine is still intact, even when you have passed parameters. This is deliberate and for ease of use. The routine will usually only be prevented from operation by pressing BREAK or turning the computer off. If you do this, it won't appear after a *HELP, reminding you that it's no longer operational. To re-use it you can either re-load it with the *SAFE command or simple type CALL &900 if you've not turned the computer off.
The routine intercepts any attempt to save a section of memory, and checks it against the filenames stored in RAM. If a match is found, then the user will be queried whether he or she wishes to overwrite the file. Please note that the routine will not check to see if the file is locked or if the disk has been changed. If any error has been found, it will be displayed.
The routine has been deliberatrely written so that it can be avoided if necessary. If you wish to fool it into thinking your file does not exist, you can either enclose it in quotation marks when these are not compulsary, place a pathname leading to the current directory or, in some instances, place a space before the filename. Please note though that the latter does not always work.
This routine can be considered Public Domain.
Ross Little, EUG #19