.title READ_HEADER - Reads Image Header .Ident /1-001/ ;++ ; Written by John Miano, published in LEVERAGE, Language & Tools ; DECUS SIG Newsletter, April 1987, pp 7-10 ; Modified by Al Sorrell, Westinghouse VAX Support Group 2/11/88 ; to also return the image name ; ; Subroutine to return the image header identification & link time. ; ; status=READ_HEADER(ident [,time [,imgnam] ] ) ; ; ident: Character string passed by descriptor, write only, ; returns the Image Identification ; ; Time: Character string Passed by Descriptor, write only, ; The image link time (23 characters) ; ; Imgnam:Character string Passed by Descriptor, write only, ; The image name (39 characters) ;-- .LINK "SYS$SYSTEM:SYS.STB"/SELECTIVE_SEARCH .LIBRARY "SYS$LIBRARY:LIB" $DSCDEF $IHDDEF $IHIDEF $SSDEF .DISABLE GLOBAL .EXTERNAL CTL$GL_IMGHDRBF $OFFSET 4,POSITIVE, .PSECT CODE,RD,NOWRT,EXE,LONG .ENTRY READ_HEADER, ^M CMPL (AP),#1 ;Make sure there's at least BGEQ ENUF ;one argument to this routine MOVL #SS$_INSFARG,R0 RET ENUF: MOVL @#CTL$GL_IMGHDRBF,R11 ; R11 = Address of image buffer MOVL (R11),R6 ; R6 = Address of image header CVTWL IHD$W_IMGIDOFF(R6),R7 MOVAB (R6)[R7], R7 ;R7 = Address of ID Block CVTBL IHI$T_IMGID(R7), R0 ; Length of the ID string MOVL IDENT(AP), R8 MOVC5 R0,(R7), #32, - DSC$W_LENGTH(R8), @DSC$A_POINTER(R8) CMPL (AP),#2 ;Want the time too? BGEQ RETURN_TIME MOVZBL #1, R0 RET RETURN_TIME: $ASCTIM_S TIMBUF=@TIME(AP), - TIMADR=IHI$Q_LINKTIME(R7) CMPL (AP),#3 ;Want the name too? BGEQ RETURN_NAME MOVZBL #1, R0 RET RETURN_NAME: CVTBL IHI$T_IMGNAM(R7), R0 ; Length of the image name MOVL IMGNAM(AP), R8 MOVC5 R0,(R7), #32, - DSC$W_LENGTH(R8), @DSC$A_POINTER(R8) MOVZBL #1, R0 RET .END