; This file updates SRDINI.MAC;1 from SRD V6.3. SRDINI.MAC;2/AU=SRDINI.MAC;1 \ -/.IDENT/,. .IDENT -6.4- ; DEC-83 .ENABL LC -/CEF001/+1 ; ; ; VERSION 6.4 - 07-Nov-83 (;BT003) ; ; Bob Turkelson ; SRD Working Group ; ; Use additional LUN for reading headers. For directories too ; large to fit into memory, the directory is kept open while ; processing it in pieces. Thus the directory LUN can not be ; re-used for reading the headers. ; Display original command line the user entered, before the ; replacement of certain symbols in the /SE, /SD, and date ; switches. ; Add sort by date capability. Merged from Henry Tumblin's ; version of SRD (which does not appear on the SIG tapes). ; Allow specification of major and minor sort keys in any order ; in the /SR:x:x:x switch, also allowing the sort to be either ; ascending or descending for any key (file name, type, version ; date). Ascending and descending capability adopted from ; changes by Dave Sides (Sachs/Freeman Assoc., Inc., c/o ; JHU/Applied Physics Laboratory)(;DJS001). Ideas for ; specifying sort keys came from the version of SRD in the ; U. S. Forest Service collection of programs appearing on the ; Spring 1982 SIG tape. The implementation here is quite ; different. ; Added the command file generation switch /CM, taken from the ; version of SRD submitted to the Spring 1982 SIG tape in the ; U. S. Forest Service collection of programs. ; Added the /PA switch to pack the file names (remove any blanks). ; Added the /TB switch to include in the summary the number of ; blocks used/allocated even if it would not otherwise appear. ; Added the /GT:n switch to select files with allocated sizes of ; at least n. blocks. ; Added the /FI:n switch to select by file ID. ; Added the /FO:[g,m] switch to select files by file owner, with ; /FO defaulting to files owned by the directory being listed; ; may be negated to select files with different file owners. ; Added the /ER switch to display files which produce errors ; when attempting to read their headers. ; Created the /NV (new version) switch as a synonym for /SV. ; Temporarily do not report errors when reading extension ; headers - treat the file as if it had a single header - unless ; the temporary switch /H2 is specified. A bug in RSX-11M V4.0 ; and RSX-11M-PLUS V2.0 causes a privilege violation reading an ; extension header unless you are in a privileged UIC or in the ; file owner's UIC. We recently determined that this does not ; occur in RSX-11M V3.2, and this problem has been corrected in ; V4.1 and RSX-11M-PLUS V2.1. ; When the date stored in the file header is corrupt, issue a ; non-fatal diagnostic message. (Previously the same fatal ; message was issued for this situation as was given for when ; an invalid date was specified in the command line.) ; Use three letters of the task name in the program prompt and in ; error messages. ; Set /SR if /SV, /NV, /OV, or /PU is specified (even if /-SR ; is specified) in order to make sure the directory gets sorted ; for these functions. ; Correctly terminate each switch value table. ; In diagnostic messages which refer to specific files include ; the UIC and file name in the message. ; Form a UIC string when the directory is opened in SRDOPR for ; use in UIC headings and diagnostic messages. ; Removed CLR instructions from SRDINI for those locations ; already cleared in the STACLR:: section of data in SRDATA. ; The check for /WB in SRDINI changed from BITB to BIT. % -,,/;BT003/ -/.MCALL...EXST$S/ .ENDC -/.IFF/,. -/.ENDC/,. -/GETPAR:/ .ENDC -/.IFF/,. -/.ENDC/,. -/STRING:/ CMFLDS: .ASCIZ /OLTVS/ ; Valid letters for second value in /CM: switch, ; ; in order of appearance on generated cmd line KEYBYT: .ASCIZ /T/<0>/N/<0>/V/<0>/D/<0> ; Valid values for sort keys ; ; each followed by a flag ; ; (0 if key not specified) .EVEN KEYDFT: .ASCII /T N VD/<0><0> ; Default ordering of sort keys for /-NA KEYDFN: .ASCII /N T VD/<0><0> ; Default ordering of sort keys for /NA -/SWTABL:/ -/SV,SVSW/ CSI$SW NV,SVSW,SWMSK$,SET,NEG,PUVAL ; Make /NV equivalent to /SV -/SR,SRSW/,. CSI$SW SR,SRSW,SWMS2$,SET,NEG,SRVAL -/HD,HDSW/ CSI$SW GT,GTSW,SWMS3$,SET,NEG,GTVAL CSI$SW ER,ERSW,SWMS3$,SET,NEG CSI$SW TB,TBSW,SWMS3$,SET,NEG CSI$SW FI,FISW,SWMS3$,SET,NEG,FIVAL CSI$SW PA,PASW,SWMS3$,SET,NEG CSI$SW CM,CMSW,SWMS3$,SET,NEG,CMVAL CSI$SW FO,FOSW,SWMS3$,SET,NEG,FOVAL CSI$SW H2,H2SW,SWMS3$,SET,NEG ; Temporary switch (reading ; ; extension header problem) -/CSI$SV...SEBUF$/ CSI$ND -/CSI$SV...LINSZ$/ CSI$ND -/CSI$SV...VRSCT$/ CSI$ND -/CSI$SV...AFBUF$/ CSI$ND -/CSI$SV...BEBUF$/ CSI$ND -/CSI$SV...LVNUM$/ CSI$ND CSI$SV DECIMAL,GTBUF$,4,GTVAL CSI$ND CSI$SV OCTAL,FIBUF$,2,FIVAL CSI$SV OCTAL,FIBUF$+2,2 CSI$SV OCTAL,FIBUF$+4,2 CSI$SV OCTAL,FIBUF$+6,2 CSI$ND CSI$SV ASCII,SKBUF$,2,SRVAL CSI$SV ASCII,SKBUF$+2,2 CSI$SV ASCII,SKBUF$+4,2 CSI$SV ASCII,SKBUF$+6,2 CSI$SV ASCII,SKBUF$+10,2 CSI$ND CSI$SV ASCII,CMBUF$,3,CMVAL CSI$SV ASCII,CMBF2$,5 CSI$ND CSI$SV OCTAL,FOGBF$,2,FOVAL CSI$SV OCTAL,FOMBF$,2 -/SRDINI::/ DIR$ #GTSK ; Get task parameters MOV PARBF$+G.TSTN,R1 ; Get first half of RAD50 task name CMP R1,#^R... ; Does task name begin with "..."? BNE 10$ ; NE - no, use the first part of name MOV PARBF$+G.TSTN+2,R1 ;Use second half of RAD50 task name BR 30$ ; 10$: CMP R1,#^RTT0 ; Might task name begin as TTn (0<=n<=7) ? BLO 30$ ; LO - no, use first part of name CMP R1,#^RTT7 ; Does task name begin as TTn (0<=n<=7) ? BLOS 40$ ; LOS - yes, use SRD> prompt 30$: MOV #ERMESG,R0 ; Point to task name part of error msg string MOV R0,R3 ; Copy pointer CALL $C5TA ; Convert part of task name to ASCII MOV #CMDBLK+G.DPRM+2,R0 ; Point to get command line prompt string MOV (R3)+,(R0)+ ; Move first two bytes of task name MOVB (R3),(R0) ; Move third byte of task name 40$: -/DIR$...#GTSK/,.+1 MOV PARBF$+G.TSTS,R0 ; Get end of buffer (from GTSK$) -/LOOP:/ -/MOV...#SW3INI/ ; Clear the area of data starting with STACLR:: in SRDATA -/3$:/ -/CLR...FLAGS$/,/CLR...VRSCT$/ -/CMDOK:/,/BNE...20$/ CMDOK: MOV G.CMLD+2(R0),R1 ; Command start MOV G.CMLD(R0),R2 ; Command length BEQ 15$ ; EQ - no command string entered MOV #LINBUF,R3 ; Temporary buffer to hold original cmd line 10$: MOVB (R1)+,(R3)+ ; Copy each byte of original command SOB R2,10$ ; Continue to end of command MOV G.CMLD+2(R0),R1 ; Command start MOV G.CMLD(R0),R2 ; Command length BNE 20$ ; NE - command string entered 15$: -/45$:/ ; Copy back original command line for including in output later MOV CMDBLK+G.CMLD+2,R1 ; Command start MOV CMDBLK+G.CMLD,R2 ; Command length BEQ 43$ ; EQ - no command string entered MOV #LINBUF,R3 ; Point to copy of original cmd line 44$: MOVB (R3)+,(R1)+ ; Copy back each byte of original command SOB R2,44$ ; Continue to end of command ; 43$: -/46$:/ -/BR...CS1ERR/,. JMP CS1ERR ; Signal error condition - call it syntax error -/47$:/ -/BNE...CS1ERR/,. BEQ 50$ ; EQ - no, proceed JMP CS1ERR ; 2 Select strings is a command error -/LST1:/ -/20$:/ BCS 28$ ; CS - Report error in date format -/27$:/ BCC 29$ ; CC - No date format error detected 28$: FERR BADD ; Report error in date format 29$: -/35$:/ BIT #NOFOSW,FLAGS$ ; Was /-FO or /NOFO detected (in SRDREP)? BEQ 36$ ; EQ - no BIS #FOSW,SWMS3$ ; Set the /FO switch for SRDLST 36$: BIT #SVSW,SWMSK$ ; Version selection required (/NV,/SV,/OV,/PU)? BEQ 37$ ; EQ - no BIS #SRSW,SWMS2$ ; If version selection, make sure sort occurs 37$: BIT #SRSW,SWMS2$ ; Sort specified? BEQ 350$ ; EQ - no ; ; Check for values given in /SR: switch. Keys must be valid. Duplicates ; are not allowed. No value may follow a null value (e.g. /SR:N::T). ; MOV #KEYBYT+1,R1 ; Point to first flag field in valid sort key ; ; value table 110$: CLRB (R1)+ ; Initialize flag field TSTB (R1)+ ; At end of table? BNE 110$ ; NE - no, more to do CLR R2 ; Show null field not yet found MOV #SKBUF$,R0 ; Start of sort keys specified in /SR switch 120$: TST (R0) ; Null value in this position? BNE 130$ ; NE - no, proceed INC R2 ; Signal that a null value has been found BR 170$ ; Go check next field 130$: TST R2 ; Was a null field previously found? BNE 150$ ; NE - yes, key following a null is invalid MOV #KEYBYT,R1 ; Point to table of valid sort keys 140$: CMPB (R0),(R1)+ ; Found key specified in the table? BEQ 160$ ; EQ - yes, here it is TSTB (R1)+ ; Not yet; skip up to next key in table TSTB (R1) ; Are we at the end of the table? BNE 140$ ; NE - no, check the next key 150$: FERR BADSK ; Invalid key specified 160$: TSTB (R1) ; Have we seen this key before? BNE 150$ ; NE - yes, duplicate key specified INCB (R1) ; Indicate we have seen this key CMPB (R0),#'D ; Was this the date sort key? BNE 170$ ; NE - no BIS #DATSRT,FLAGS$ ; Set special flag 170$: TST (R0)+ ; Point to next sort key specified in /SR switch CMP R0,#SKEND$ ; Are we at the end of the specified keys? BLO 120$ ; LO - no, check the next sort key ; ; If /NV, /SV, /OV, or /PU are specified, there are certain requirements on ; the order of the sort keys. The first sort key must be T or N, the second ; one must be either T or N and different from the first one, and the ; third key must be V. When checking keys in order, if we find a null, ; the keys are valid - the section after this one will fill in the missing ; required keys in the correct order. We do not need to check that the ; first and second are different - the check for duplicate keys was done ; above. ; 200$: BIT #SVSW,SWMSK$ ; Version selection required (/NV,/SV,/OV,/PU)? BEQ 300$ ; EQ - no, proceed MOV #SKBUF$,R0 ; Start of sort keys specified in /SR switch TST (R0) ; Is first key null (and hence all keys)? BEQ 300$ ; EQ - yes, proceed CMPB (R0),#'T ; Is first key "T"? BEQ 210$ ; EQ - yes, first key is OK CMPB (R0),#'N ; Is first key "N"? BNE 230$ ; NE - no, version selection cannot be requested 210$: TST (R0)+ ; Point to second specified key TST (R0) ; Is second key null? BEQ 300$ ; EQ - yes, so switch is valid CMPB (R0),#'T ; Is second key "T"? BEQ 220$ ; EQ - yes, second key is OK CMPB (R0),#'N ; Is second key "N"? BNE 230$ ; NE - no, version selection cannot be requested 220$: TST (R0)+ ; Point to third specified key TST (R0) ; Is third key null? BEQ 300$ ; EQ - yes, so switch is valid CMPB (R0),#'V ; Is third key "V"? BEQ 300$ ; EQ - yes, switch is valid 230$: FERR BADSV ; Specified keys invalid with /NV,/SV,/PU,/OV ; ; Move in required keys which have not been specified ; 300$: MOV #KEYDFT,R1 ; Start of default sort keys for /-NA BIT #NASW,SWMSK$ ; Sorting by name first? BEQ 310$ ; EQ - no MOV #KEYDFN,R1 ; Start of default sort keys for /NA 310$: MOV #SKBUF$,R0 ; Start of sort keys specified in /SR switch 320$: TST (R0) ; Was a key specified in this position? BEQ 330$ ; EQ - no CMPB (R0),(R1) ; Found this key here? BEQ 340$ ; EQ - yes TST (R0)+ ; Point to next sort key CMP R0,#SKEND$ ; At end of specified sort keys? BLO 320$ ; LO - no, look for the key in this position BR 150$ ; Should never get here: past all sort key ; ; fields without using up all defaults 330$: MOV (R1),(R0) ; Copy in default key 340$: TST (R1)+ ; Point to next default key TST (R1) ; Any more default keys left to check? BNE 310$ ; NE - yes, search for next default key 350$: BIT #CMSW,SWMS3$ ; Generating command file? BEQ 450$ ; EQ - no BIS #PASW,SWMS3$ ; Set the pack-file-name switch CLR CMFLG$ ; Clear all bits in /CM flag word MOV #CMBF2$,R1 ; Point to start of second /CM: switch value TSTB (R1) ; Any value specified? BEQ 450$ ; EQ - no 410$: MOV #CMFLDS,R2 ; Point to valid options (OLTVS) MOV #1,R3 ; Bit 0 in flag word represents first option 420$: CMPB (R2)+,(R1) ; Found specified character in table of options? BEQ 430$ ; EQ - yes ASL R3 ; Next bit to left represents next option TSTB (R2) ; At end of options? BNE 420$ ; NE - no, check next one DIAG BADCM ; Specified value invalid; tell user; ignore BR 440$ ; Go on to next specified character 430$: BIS R3,CMFLG$ ; Set this bit in /CM flag word 440$: TSTB (R1)+ ; Point to next specified character TSTB (R1) ; At end of characters specified in switch? BNE 410$ ; NE - no, another character present - process 450$: -/SRTDIR:/ -/BITB...#WBSW/,. BIT #WBSW,SWMS2$ ; Is directory to be written back? -/5$:/ -/ALUN$S/ ALUN$S #HDRLUN,SAVDVN,SAVUNM ; Set LUN for reading headers MOV #HDBUF$,HDPTR$ ; Use main header buffer -/INIEX:/ -/ALUN$S/ ALUN$S #HDRLUN,SAVDVN,SAVUNM ; Set LUN for reading headers /