SETATT - A FILE ATTRIBUTE CHANGE UTILITY FOR CP/M Copyright: Ian Ashdown byHeart Software 2 - 2016 West 1st Avenue Vancouver, B.C. V6J 1G8 December 15th, 1983 NOTICE: This program has been released into the public domain for non-commercial use. Version: 1.0 Use: "SETATT" is designed to replace CP/M's "STAT" utility for setting the READ-ONLY and SYSTEM attribute of a file. The command line syntax expected by SETATT is: SETATT [d:]filename.typ where can be one of: R/W to reset files to Read/Write R/O to set files to Read/Only DIR to reset files to Directory SYS to set files to System The following example indicates how to use SETATT to set a group of files to R/O. The symbol (x) denotes that the operator has typed the character 'x' at the console as a response. Note that the wild card characters "?" and "*" are permitted to specify ambiguous file names. Also (not shown), typing ^C in response to any question will terminate the program without changing any file attributes. Example: A> SETATT PRO*.??? R/O SETATT - Version 1.0 Copyright 1983 File Name: SYSTEM Attribute: Change to READ-ONLY? A: PROG .TXT DIRECTORY ? (Y) Yes A: PROG .ASM DIRECTORY ? (N) No A: PROG .001 SYSTEM ? (N) No A: PROGRESS.BAS DIRECTORY ? (Y) Yes A: PROGRESS.INT DIRECTORY ? (Y) Yes O.K. to change? (Y) Yes The following information and examples are taken from an article in the May, 1984 issue of Microcomputing magazine, which was written by Ian Ashdown, the author of the SETATT program. For those of you unfamiliar with file attributes, a word of explanation: most computer Operating Systems allow you to assign various status indicators to a file. These indicators, or attributes, determine the operations that can be performed on the file by an application program. CP/M-80 (versions 1.4 through 2.2) recognize only two such attributes, read-only and system. Through these attributes, any CP/M-80 file can be assigned either a read/write (R/W) or read-only (R/O) status, and a directory (DIR) or system (SYS) status. A file that is designated as R/W can be read from, written to or erased by any application program, and one that is designated as a directory file will be displayed by the DIR command in a directory listing. A file that is assigned the R/O attribute can only be read; it cannot be written to or erased by mopst application programs. Similarly, a file designated as a SYStem file won't be displayed in a directory listing resulting from a DIR command or most similar utility programs. NOTE -- Some of the more advanced versions of DIR and its derivatives contain options for displaying files with various combinations of file attibutes set. (For examples, see ZCPR.DOC and SD-44.DOC on Volume 12 and Volume 5 respectively of the BAMDUA library disks.) These file attributes can be useful. By assigning a R/O status to important files, you can avoid inadvertently erasing them by typing ERA *.COM instead of ERA B:*.COM. It's also nice to be able to examine a directory listing without having to scan all the names of utility programs kept on your disks. By making these programs SYStem files, the directory listing can be limited to those files that are of interest. STAT, a utility available at the CP/M command level, is available for this purpose. Unfortunately, STAT changes the requested attribute of ALL files that match the ambigous filename mask on the command line -- whether or not that attribute was correct to begin with! There are other problems with using STAT to change file attributes. Occasionally, you might enter something like STAT A:*.COM $SYS when you meant to enter STAT B:*.COM $SYS. STAT immediately assigns a SYS attribute to all your command files on drive A. Now, if your DIR command can't list them, how can you remember which ones to reassign the DIRectory attribute to? The only solution is to use STAT A:*.COM $DIR to assign the DIR attribute to ALL the command files on the disk and then individually reassign the SYS attribute to those files that orginally had it--assuming you can remember which ones they are, that is. What is needed is a utility program designed specifically to set or reset the attributes of one or more files. It should be easy to understand and use, and it should: 1. Accept an unambiguous or an ambiguous filename. 2. Find all the files that don't have the desired file attribute. 3. Display each filename and the status of the arrtibute that won't be changed. 4. Ask the operator whether the attribute in question should be changed before proceeding to the next filename. 5. Having displayed all relevant files, it should ask the operator for final confirmation before actually changing the attributes of the indicated files. SETATT is such a program. It is written in 8080 assembly code and will function properly under both CP/M-80 version 1.4 and versions 2.0 through 2.2. The program code was entered from the SETATT.PRN listing reproduced in the text of the magazine article. I added the optional drive feature, modified the data statements to make the screen display more pleasant to view if Morrow's virtual drive feature is invoked, and improved the help screen displayed by the program if the parameter is missing or invalid. (Note: To get a quick review of the program's command syntax, enter just the command name at the system prompt, i.e. SETATT ). If the drive specifier is omitted, the currently logged drive will be used as the default. Also note that the parameter can be entered in lower case because CP/M converts the command line to upper case before it is processed. To answer a question "Yes", enter a 'Y' or 'y'; any other character, including , is interrupted as "No" except for a '^C', which causes a program abort. To get a listing of all files on a particular disk and the current attribute settings for each file, enter: STAT [d:]*.* The status of the read attribute will be denoted by R/W or R/O preceeding the filespec. If the directory attribute is set to SYS, the filename will be enclosed in parentheses. Gene Korte BAMDUA Librarian 07/28/84