.TITLE FSPEC ; ;---- Purpose: Retrieve the directory + file specification ; from the input header buffer passed from an ; already open INDEXF.SYS ; ;---- Arguments: ; F_HEADER=4 ;Input 512*(I*1) Header buffer RAB=8 ;Input RAB D_FSPEC=12 ;Output C*(*) Filespec descriptor D_HEADER=16 ;Output 512*(I*1) Buffer for directory file headers IREC=20 ;Output I*4 Directory file header record # OFFSET=24 ;Input I*4 OFFSET+FID=VBN of file header ; ;---- Note that for proper operation of this subroutine, the RAB should ;---- specify: UBF=D_HEADER, RAC=KEY, KBF=IREC ; ;---- Equates: ; F.DID = ^O102 ; Directory ID in file header F.NAM = ^O114 ; File name in file header .PSECT FNDATA,WRT,NOEXE,LONG DIR: .ASCII '.DIR' DELIM: .LONG 0 LIFO: .BLKB 128 LIFO_END: .ADDRESS . ; .PSECT CODE,NOWRT,EXE .ENTRY FSPEC,^M ; MOVAL LIFO_END,R6 ; R6 points to end of LIFO buffer MOVAL @F_HEADER(AP),R7 ; R7 points to File Header MOVAL F.NAM(R7),R8 ; R8 points to file name in header LOCC #^A' ',#20,(R8) ; Locate trailing blank in file name 3$: MOVB -(R1),-(R6) ; Move filename to LIFO CMPL R1,R8 BGTRU 3$ MOVB #^A']',DELIM ; ] 5$: MOVB DELIM,-(R6) ; dump delim into Lifo MOVB #^A'.',DELIM MOVZWL F.DID(R7),@IREC(AP) ; Directory ID from header ADDL @OFFSET(AP),@IREC(AP) ; Offset + ID = INDEXF file record # $GET RAB=@RAB(AP) ; Get directory header BLBC R0,ERROR MOVAL @D_HEADER(AP),R7 ; R7 points to directory file header MOVAL F.NAM(R7),R8 ; R8 points to file name in header MATCHC #4,DIR,#20,(R8) ; Look for '.DIR' BNEQ ERROR SUBB #4,R3 ; Skip in front of '.DIR' 10$: MOVB -(R3),-(R6) CMPL R3,R8 BGTRU 10$ CMPL #^X40004,F.DID(R7) ;Test for 000000.DIR BNEQ 5$ ;If not, go get next level directory 25$: MOVB #^A'[',-(R6) MOVAL @D_FSPEC(AP),R2 ; R2 points to output filespec descr. SUBL3 R6,LIFO_END,R1 ; # of characters in LIFO MOVC5 R1,(R6),#^A' ',(R2),@4(R2) ; Unload LIFO MOVZWL #SS$_NORMAL,R0 RETURN: RET ERROR: MOVL #SS$_BADPARAM,R0 BRW RETURN .END