.TITLE SRDROT .IDENT -6.62- ; Nov-87 .ENABL LC ; ; CORRECTION WB02---MAKE SURE STACK IS CLEAN WHEN DOING ; WILD CARD DIRECTORY SEARCHS. ; ; MODIFIED: ; THIS VERSION MODIFIED DEC 1978 BY RAY VAN TASSLE---MOTOROLA ; 1) FIXED ERROR IN DIRECTORY WRITE-BACK THAT WOULD LOSE FILES. ; 2) FIXED ERROR (11D) IN FIGURING WORK BUFFER SIZE ; 3) REPLACED TO: DEVICE WITH TI: ; 4) FIXED A COUPLE OF INITIALIZATION BUGS THAT WOULD SOMETIMES ; CAUSE SORT & LIST TO RUN WILD ; 5) FIXED A TOO-SMALL BUFFER IN TRAP ROUTINE (ERROR PRINT) ; ; 6) CHANGES TO ALLOW A VERY LARGE DIRECTORY BE DONE IN PIECES ; (WITHOUT WRITE-BACK, THOUGH) ; 7) REMOVED THE UN-USED "/HV" SWITCH ; 8) ADDED "/MI" SWITCH (MIDDLE-SIZE LISTING---WITH DATE & TIME) ; 9) CHANGED DEFAULTS TO /LI/NA ; 10) PRINT # OF FILES SELECTED & TOTAL ; 11) CHECK FILE ID/SEQ # IF /MI OR /DA OR /FU, ETC. ; 12) CHANGED SO /-LI DOES EVERYTHING EXCEPT ACTUAL LIST ; 13) PUT "TAB" AS 1ST CHAR ON LISTING LINE ; 14) EXCLUDE [0,0] FROM WILD-CARD UIC (ALSO [0,*] AND [*,0]) ; 15) IN /SE TEMPLATE, BOTH "%" AND "?" MATCH ANY ONE CHAR. ; 16) ADDED ERROR MESSAGE AND RE-TRY ON ERROR DURING DIRECTORY WRITE-BACK ; ; VERSION 4.1, 08-MAR-79 ; BRUCE C. WRIGHT ; DUKE UNIVERSITY MEDICAL CENTER ; DURHAM, N. C. 27710 ; NUMEROUS BUG FIXES AND CONDITIONALISE FOR IAS/RSX-11D ; ; VERSION 4.1A - 11-JUL-79 ; ADD SUPPORT FOR /CO/LO/MU SWITCHES ; VERSION 4.1B - 15-JUL-79 ; ADD SUPPORT FOR /BE AND /AF FOR SELECTION OF FILES BETWEEN ; THE TWO DATES; ; LIST CREATION DATES WITH /DA SWITCH AS WELL AS WITH /AF AND ; /BE SWITCHES. ; VERSION 4.1C - 18-JUL-79 ; TREAT FILE SPECIFICATION STRING GIVEN IN COMMAND LINE ; (BUT NOT IN /SE: OR /SD: SWITCH STRING) AS IF IT HAD ; WILD CARD MATCHING AFTER NAME AND TYPE STRINGS GIVEN, ; UNLESS /DE, /SD, OR /PU SPECIFIED; ALSO INSERT '.' IF ; NONE GIVEN IN /SE: OR /SD: SWITCH STRING. ; VERSION 4.1D - 29-JUL-79 ; FIX BUG IN /SD PROCESSING SO ALONE DOES NOT CAUSE FILE ; DELETION IF 'Y' PREVIOUSLY ENTERED; ALSO IMPLEMENT ; YES/NO/QUIT/GO RESPONSES FOR /SD, ACQUIRED FROM THE JACKSON ; LABORATORY VERSION; AND MINOR FIX TO AVOID SYNTAX ERROR IF ; NAME.TYP/SD USED AFTER PREVIOUS /SD:NAME.TYP OR /SE:NAME.TYP. ; VERSION 4.1E - 30-JUL-79 ; ADD SUPPORT FOR /OV:[N] SWITCH TO LIST OBSOLETE VERSIONS OF ; FILES, WHICH ARE THE FILES WHICH WOULD BE DELETED IF THE ; /PU:[N] SWITCH WERE USED, AND THOSE WHICH WOULD NOT BE LISTED ; IF THE /SV:[N] SWITCH WERE SPECIFIED. ; VERSION 4.1F - 05-AUG-79 ; CONDITIONALIZE FOR RSX-11M V3.0 AND EARLIER VERSIONS, AND ; FOR APPENDING WILD CARD MATCHING CHARACTERS TO IMPLICIT ; SELECTION FILE NAME STRING (THE VERSION 4.1C MODIFICATION). ; ; BOB TURKELSON ; NASA/GODDARD SPACE FLIGHT CENTER ; CODE 934 ; GREENBELT, MARYLAND 20771 ; ; DUKE004 -- 19-NOV-79 -- ADD VERSION NUMBER MESSAGE, ALSO MODIFIED ; UFD FILE DESCRIPTOR BLOCK SO IF SRD ABORTS ABNORMALLY, ; IT WON'T LOCK THE UFD FILE, ALSO REMOVED REFERENCE ; TO .MOLUN SINCE MO.... IS NOT USED BY SRD. ; ; VERSION 5.0 - 19-NOV-79 ; ; PREPARE SIG SUPPORTED VERSION, UPDATED ALL MODULES ; TO VERSION 5.0, ADDED /IDENT,/BF SUPPORT. ; H.R.TUMBLIN, DUMC ; ; VERSION 6.0 - 28-Nov-80 ; ; By: Phil Stephensen-Payne, ; c/o Systime Ltd., ; 432 Dewsbury Road, ; LEEDS LS11 7DF, ; England. ; ; Combined the two versions above into one. ; Added /AE, /BF, /HE, /AT, /M2, /00 ; Added time handling into date handling ; Used global TKB patches for initialization ; Modified wild-carding to be more flexible ; ; VERSION 6.1 - 01-DEC-81 ; ; Bob Turkelson, NASA/GSFC, Code 935, Greenbelt, MD 20771 ; ; Corrected bug which prevented /WB/-LI from working properly; ; Ignore /WI and /WD implicit wild-carding whenever the /SE ; switch is specified; ; Added /ZE switch to list zero used block files; ; When header attributes show 0 blocks allocated, calculate value ; from retrieval pointers, and include in directory total ; ; ; VERSION 6.2 - 13-JUL-82 (;RBD001) ; ; Bob Denny ; Creative System Design Co. ; 3452 E. Foothill Blvd. Suite 601 ; Pasadena, CA 91107 ; ; General update for RSX-11M Version 4.0: ; Lower case messages ; Conditional spawn to CLI... if multi CLI support ; Many small mods to SRD.CMD build command file ; Support for Exit with Status (EXST$x) ; New ODL for V4.0 PLAS FCSRES ; ; ; VERSION 6.3 - 01-Jun-83 (;BT002 and ;CEF001) ; ; Bob Turkelson ; ; Merged in /SM, /HD, and /BK switches from Glen Everhart's ; Fall 1982 version; ; Do not allow /DE without file name or /SE specified; ; When file name on command line has no ".", append ".*;*" ; only when original search string ended in "*" (e.g., ; /SE:*ABC*); otherwise, append ".;*", to prevent deletion ; of all files with that name and any type (e.g., when ; GHI/DE specified) ; Correct bug which caused version number selection to fail ; to list the proper files in many cases. ; ; Carl E. Friedberg ; ; Have flattened out for MPLUS; also will set PSECT attributes ; here ; ; ; VERSION 6.4 - 07-Nov-83 (;BT003 and ;DJS001) ; ; Bob Turkelson ; SRD Working Group ; ; Correct calculation of number of memory blocks to extend ; task so that upper bits are cleared if sign bit propagation ; has occurred. (Previously had memory protection violation ; for a sufficiently large directory since task would shrink.) ; 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. ; Issue a fatal message if write-back is specified and the ; directory is too large to fit into memory. Determined before ; any directory sorting is done, to save the sorting time. ; (Previously a directory write-back cancelled warning was ; issued, but the last piece of the directory was written ; anyway, wiping out most of the directory.) ; 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. ; Search forward in the sorted directory to determine the number ; of versions when highest or obsolete version selection is ; required, and remember where a new file name and type is ; found. Necessary to take care of ascending version ; numbers. (Replaces code which compared each entry with ; both the previous and the next entries.) A check for end ; of directory is performed. (Previously possible to get a ; memory protection violation error when checking last entry ; of a dense directory which exactly filled the last block.) ; Do not "CLR (R1)" before returning from SRDCOM (SRDSUB). This ; instruction is no longer necessary. It caused a memory ; protection violation problem when compressing a dense ; directory whose length was six or more blocks if SRD was ; built to use the extend task directive, and the end of the ; SRDLST overlay section ($$$XX3) happened to be on a 64-byte ; boundary, or two bytes before such a boundary (that is, with ; address ending in 00 or 76). ; 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. ; Reference double word (rather than single word) values in the ; file headers to report a file's used and allocated blocks. ; For files with multiple headers, calculate the number of ; allocated blocks from the retrieval pointers (as has been ; done for any file when the header attributes show zero blocks ; allocated). Read each extension header into a buffer which ; starts at the beginning of the retrieval pointer area of the ; buffer for the first header. Only 51. additional words are ; needed for the buffer since the overlap is 205. words. ; 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. ; Eliminate the extra zero byte appearing at the end of the UIC ; line. ; Eliminate the extra zero byte appearing at the end of a ; diagnostic message. ; In diagnostic messages which refer to specific files include ; the UIC and file name in the message. ; Never "select" a file with a header read error. No further ; selection checks are performed for such a file. ; Do not "select" a file when a corrupt date is detected in ; the file header if file selection by date is requested. ; Make sure the UIC line for the directory appears when issuing ; a diagnostic for a header read error or for a corrupt date ; in the header. ; Set a flag bit in FLAGS$ at the beginning of SRDLST if the ; switches require a header read. Testing this bit where that ; information is needed eliminates duplicate code. ; Form a UIC string when the directory is opened in SRDOPR for ; use in UIC headings and diagnostic messages. ; Move the error message buffer so that it overlaps the prompt- ; for-selective-delete buffer. ; Code for converting the file name to ASCII moved to a new ; routine CVTNAM within SRDLST. ; 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. ; For IAS systems define the $$$XX1, $$$XX2, and $$$XX3 dummy ; psects with the RO attribute so that they are located in ; the proper location: after the code in their respective ; overlay segments. ; Calculation of end-of-file block number is done once rather ; than three times. ; ; ; VERSION 6.5 - 16-Jan-85 (;WG001) ; ; SRD Working Group ; ; Add information to the /ID message telling which operating ; system and support features were specified when this task ; was generated. ; If named directories not supported, ignore any that exist ; in the MFD. ; Add support for named directories for P/OS and Micro/RSX. ; Spawn ...HEL for help on P/OS systems since there is no CLI. ; Use decimal format for file version numbers in P/OS. ; Add the /AP switch to append the listing to an existing file. ; Interpret the input file spec and switches before opening ; the output file to allow /AP on either the output or input ; file specification. ; Correct bug so that diagnostic message for corrupted date ; in file header is not repeated for files with proper dates. ; In the CVDATE routine (in SRDSUB), skip over the first ; byte of the date field if it is blank. When ; VMS BACKUP/IMAGE restores a Structure 1 disk, a file ; date with a single digit day of month is stored in ; the file header with a blank preceding the digit, ; rather than a zero character as is done in RSX. ; (For example, " 4OCT84" rather than "04OCT84".) ; For all systems except RSX-11M-PLUS define the $$$XX1, ; $$$XX2, and $$$XX3 dummy psects with the RO attribute ; so that they are located in the proper location on ; RSX-11M V3.2 systems as well as on the other systems. ; ; ; Version 6.6 - 12-Jun-85 (;WG6.6) ; ; SRD Working Group ; ; Modify the sort algorithm in SRDSRT for improved performance. ; (Thanks to Jim DeMange and Tony Gandy of Systeme ; Corporation, Orlando, FL.) ; Turn off /HD (command line display) when a listing file is ; not specified. There is no need to display the command ; line when listing files on TI:. ; Move restoring of the original command line to the end of ; SRDINI to correct problem where an output filename ; spec with embedded blanks resulted in a "Directory not ; found" error message. ; Rewrote most of SRDTST, making the logic easier to ; follow, while fixing a bug which ignored /WI when a '*' ; was given in the match template (e.g. AB*D failed to match ; ABCDE). ; ;= ; .PSECT SRDCOD,I,RO,CON,REL,LCL ; ;+ ; ; **SRD--SORT DIRECTORY ; ; TASK ROOT SEGMENT ; ; THIS TASK WILL SORT A FILES-11 DIRECTORY ; THEN CREATE A LISTING WITH SEVERAL SELECTION OPTIONS ; ; THIS IS THE MAIN ROUTINE, AND IS PURE. ; ;- ; ; SYSTEM MACRO CALLS ; .MCALL FINIT$,CLOSE$,QIOW$S $SRD0:: ; INITIAL ENTERY MOV $XX1,DIRBF$ ; FIGURE OUT LOWEST AVAIL LOCATION CMP DIRBF$,$XX2 BHI 44$ MOV $XX2,DIRBF$ 44$: CMP DIRBF$,$XX3 BHI 45$ MOV $XX3,DIRBF$ 45$: ADD #3,DIRBF$ ; ROUND UP TO NEXT 4-BYTE BOUNDARY BIC #3,DIRBF$ ADD #4,LIMBF$ ; Ensure @DIRBF$ is always mapped MOV LIMBF$,MINSZ$ ; Get the minimum buffer size SUB DIRBF$,MINSZ$ ; ADD #777,MINSZ$ ; Round up to 512 byte boundary BIC #777,MINSZ$ ; MOV SP,SAVSP ; MARK THE STACK FINIT$ ; SET UP FCS MOV #EX$SUC,X$STAT ; INITIALLY, ASSUME SUCCESS ;RBD001 SRD1: CALL SRDINI ; INIT NEXT RUN BIT #IDSW,SWMS2$ ; CHECK FOR /ID SWITCH BEQ 10$ ; EQ - THEN IT'S NOT SET QIOW$S #IO.WVB,#TTYLUN,,,,,<#SRDVER,#SRDVS,#0> BCC LSTNX$ ; CC - THEN SUCCESS CALL ALERR ; DIAGNOSE ERROR BR LSTNX$ ; AND START OVER 10$: BIT #SISW,SWMS2$ ; DISPLAY BUFFER SIZE BEQ SRD2 ; EQ - NO CALL SRDDBF ; DISPLAY BUFFER SIZE BR LSTNX$ ; AND START OVER SRD2: CALL SRDOPR ; OPEN AND READ UFD CALL SRDSRT ; SORT THE DIRECTORY TST R5 BEQ 5$ FERR WBERR ; 5$: CALL SRDLST ; LIST THE FILE ; 10$: TST UFDFDB+F.BDB ; DIRECTORY STILL OPEN ?? BNE SRD2 ; YES, GO DO NEXT PIECE OF IT. ; LSTNX$:: MOV SAVSP,SP ; MAKE SURE STACK IS CLEAR ; *WB02* .IF DF R$$11M ; IF ON RSX11M .IF NDF D$$CAL ; IF NO DYNAMIC CHECKPOINTING... MOV DIRIC$,R1 ; R1 = LAST INCREMENT. BEQ 10$ ; IF EQ, WE ARE AT INITIAL SIZE. CLR DIRIC$ ; SAY WE ARE BACK TO INITIAL SIZE. NEG R1 ; INDICATE DECREASE SIZE EXRG$S R1 ; GO BACK TO ORIGINAL SIZE. BCC 10$ ; IF CC, ALL OK HALT ; ABORT TASK. .ENDC .ENDC ; 10$: CLOSE$ #UFDFDB ; Close the UFD TST NXUIC$ ; DOING WILD CARD? BEQ RESTR$ ; BR IF NO BIC #HDFL,FLAGS$ ; FLAG HEADER NOT PRINTED CLR NUMFS ; TO COUNT # OF FILES CLR NUMFT CLR TBLKU ; CLEAR BLOCK COUNTS CLR TBLKU+2 CLR TBLKA CLR TBLKA+2 CALL SRDNUD ; FIND NEXT DIRECTORY TO WORK ON BCC SRD2 ; PROCESS IF ONE FOUND RESTR$:: ; RESTART FOR SURE! BIT #SISW!IDSW,SWMS2$ ; ID ! SI active ? BNE 10$ ; NE - then skip rest BIT #LISW!MISW!FUSW,SWMSK$ ; LISTING ACTIVE? BEQ 10$ ; BR IF NO BIT #FLFL,FLAGS$ ; ANYTHING GET LISTED? BEQ 5$ ; BR IF NO FILES BIT #SPSW,SWMSK$ ; SPOOL THIS FILE? BEQ 10$ ; BR IF NO MOV #LSTFDB,R0 ; GET THE FILE DESC. BLK CALL .PRINT ; INSERT IN PRINT QUEUE BR 10$ ; CONTINUE 5$: ; REFERENCE DIAG NOFL ; ISSUE "NO SUCH FILE" DIAGNOSTIC 10$: MOV SAVSP,SP ; CLEAN THE STACK CLOSE$ #UFDFDB ; Make sure UFD is closed CLOSE$ #LSTFDB ; --- BIT #ATSW,SWMS2$ ; Were we attaching things? BEQ SRD1 ; If EQ no - don't bother to detach JSR R0,ATTDET ; MAKE SURE DEVICE- .WORD IO.DET ; --IS DETACHED! BR SRD1 ; ELSE START OVER-FROM THE TOP! ; ; CCLOSE-CONDITONAL CLOSE ; ; THIS ROUTINE IS CALLED WITH AN FDB ADDRESS IN R0 ; IT DISPATCHES TO CLOSE IF THE FILE IS OPEN, ; ELSE RETURNS DIRECTLY TO THE CALLER. ; CCLOSE::TST F.BDB(R0) ; IS FILE OPEN? BEQ 10$ ; BR IF YES JMP .CLOSE ; CLOSE THE FILE 10$: RETURN ; ELSE GO BACK FORM HERE .PSECT $PDATA CON,RW,D,LCL SSTVC$::.WORD 0,0,0,0,0,0 .WORD TRAP0 .END $SRD0