UNERASE Version 1.4 Howard Goldstein April 4, 1991 UNERASE is a ZCPR3 utility for recovering files that have been erased in error. It will also list the names of erased files without recovering them. Not for Z3PLUS. USAGE: UNERASE {du:}afn{,afn{,afn{,...}}} {{/}options} Files are recovered on the given drive and to the given user (a DIR specification can be given). If no DU is given, the current defaults are used. Only the first drive/user specification is observed; DU specs after first are ignored (that is, all following files are assumed to be on the same drive and are recovered to the same user area). As distributed, ambiguous filenames put UNERASE into list-only mode: matching erased files are listed to the screen, but no files are recovered. To recover files enter a list of unambiguous filenames. OPTIONS: L List matching erased files only. With this option no erased files are recovered, but all erased files that match the file specification will be listed to the screen. As distributed, this mode is set automatically if an ambiguous filename is given. P Don't page screen output. In list-only mode the screen is paused each time it fills. This option will toggle paging off, unless paging has been turned by the default, in which case the option will turn paging on. Paging does not work when files are been recovered because partially restored files may be left on the disk and may cause serious problems. The number of screen lines is obtained from the environment. C Pause first for disk change. This option causes UNERASE to prompt for a new disk immediately after it is invoked (probably useful only if you have a single disk drive. If the disk change pause is configured as the default mode, option C will toggle it off. CONFIGURATION: Options P and C can be configured as the defaults. In addition, UNERASE can be configured to allow recovery of ambiguous filenames, if you insist on that ability. (You'll probably change it back the first time you forget the L option and recover a bunch of files you don't want.) Configuration is accomplished with ZCNFG and the UNERASnn.CFG file. It is best not the change the name of the CFG file so that ZCNFG will always be able to find it and so you won't use a CFG file for the wrong version of UNERASE. UNERASING FILES: Successfully recovering a file is dependent on several factors, the main one being whether any writing has been done to the disk since the file was erased. If so, recovery is less likely. Part of the file might be recovered, but other blocks allocated to the file may contain data from a newly written file. That is pretty easy to determine with text files, but you won't know about an executable file until you try to run it and it crashes your system. Erasing such an improperly recovered file should be immediately followed by a disk reset. Otherwise, your system will think the blocks are free even though they're being used by another file. Reseting hard disks and RAM disks on ZRDOS or ZSDOS systems requires calling a relogging program, such as DISKRST or RELOG. If there are two or more erased files with the same name, UNERASE will recover all of them. After the recovery only the first one in the directory will be accessible, but the others will take up disk space and you won't be able to erase one of them without erasing both or all of them. There is hope, though, especially if the files are less than an extent in length (usually 16K or 32K, depending on your system). Try copying them to another disk using an ambiguous filespec and using a copy utility that prompts you before overwriting an existing file. If the first copy of the file is the one you want, answer "No" when the copy utility prompts for an overwrite as it tries to transfer the second copy of the file. If the second copy is the one you want, answer "Yes" to the overwrite prompt. Once you have the correct copy on another disk, you can safely erase the copies you recovered with UNERASE. Then be sure to relog your disk. You're more likely to avoid problems with UNERASE if you regularly clean your disk directories with CHKDIR and SAPZ. HISTORY: Version 1.4 -- April 4, 1991 -- Howard Goldstein Modified to skip the initial FRESET call if the target drive can be determined to be a fixed disk. This eliminates the long delay when the program starts up. User number is no longer displayed in List mode. The code has been cleaned up and reorganized in several places. Version 1.3 -- March 26, 1991 -- Gene Pizzetta Did not properly relog hard drives or RAM disks under ZRDOS or ZSDOS. Incorporated Bridger Mitchell's FRESET routine, to correctly relog drives on all systems. Removed internal environment. Converted to Zilog mnemonics. Option "Z" (recover files to user 0) eliminated; now recovers files to default user, or to user given in DU spec. Screen now pages if more than screenful of matching erased files are found. "Pause for disk change" option changed to "C"; "P" now controls paging. Options "C" and "P" can be configured as defaults. Wildcard filenames now sets "L" option for listing names of erase files; actual unerasing requires unambiguous filenames in the file list. This method can be changed to allow unerasing wildcard filenames (kind of dangerous) by a configuration option. Configuration by ZCNFG. (Paging is always off when files are actually being recovered, for safety reasons.) Now aborts if not ZCPR3 or if CP/M-Plus. Following bugs fixed: (1) Disk change routine didn't work right (the disk parameters were being read before the routine was called), (2) giving drive on command line didn't always work, (3) illegal drive spec detection never worked (now works for ZCPR33 or higher), (3) printed filename more than once if file extended for more than one data module (S2), (4) read wrong disk parameter block if drive allowed disks with more than one format and disk wasn't last one read (now resets drive unconditionally before reading DPB, so we always get the correct DPB). Version 1.2 -- September 25, 1985 -- Roger Warren Found and removed two more subtle nasties related to BIOS calls: (1) call to WRITE did not specify type, which could cause data to be lost; (2) call to SELDSK did not set-up E register (new mount flag). Version 1.1 -- September 20, 1985 -- Roger Warren Removed 2 MAJOR bugs: (1) wrong disk may be selected; (2) incorrect use of BIOS "SECTRAN". Version 1.0 -- May 18, 1984 -- Rick Conn Modified to be consistent in the ZCPR3 tool set. The following are are ZCPR2 predecessors: Version 2.2 -- July 25, 1983 -- Rick Conn UNERA for ZCPR2. Version 2.0 -- July 23, 1983 -- Rick Conn UNERA for ZCPR2. Modified to be consistent in the ZCPR2 tool set. The following are UNERA non-ZCPR predecessors: Version 1.6 -- Dave Rand Version 1.5 -- Irv Hoff Version 1.4 -- Paul Traina Version 1.3 -- Irv Hoff Version 1.2 -- Charlie Strom Version 1.1 -- Bruce Blakeslee Version 1.0 -- Henry Rothberg Retyped from Interface Age (Dec 81). Derivation: UNERA, "Program to Recover Erased Files" by Gene Cotton, Interface Age, December 1981, page 146.