/* REXX *** */ ADDRESS SYSCALL /* report on linkedit information for HFS binary */ PARSE ARG fname If Envir \= 'SH' then , IF SYSCALLS('ON')>3 THEN DO SAY 'Unable to establish the SYSCALL environment' SAY 'Return code was 'RC RETURN END /* determine the real path */ 'realpath 'fname' path' If retval = -1 then Do Say 'Unable to resolve path 'fname Exit 8 End /* check for sticky bit on executable */ /* in case this is not the real module */ 'stat 'fname' stat.' If stat.st_sticky then , Say 'Sticky bit ON - executable loaded from system library' /* open the file */ 'open 'path o_rdonly fd = retval If fd = -1 then Do Say 'Unable to open 'path Exit 8 End Say 'File 'path /* read the header */ 'read (fd) buff 1024' Bytes = retval If Bytes = -1 then Say 'Error 'errno errnojr /* check for expected conditions */ If Substr(buff, 1, 8) \= 'IEWPLMH' | , Bytes < 56 then Do Say 'File 'path' is probably not an executable' Exit 8 End /* undocumented */ x = C2D(Substr(buff, 55, 2)) + 1 /* mapped by macro IEWPMAR */ len = C2D(Substr(buff, x, 2)) /* possible change in mapping macro? */ If len \= 30 then , Say 'Length of attribute section is 'len clvl = C2D(Substr(buff, x+2, 1)) Say 'Compat = PO'clvl blvl = C2D(Substr(buff, x+3, 1)) If blvl < 5 then , Say 'Unexpected link-edit level 'blvl else , Say 'Created by Binder Version 'blvl-4 flag = X2B(C2X(Substr(buff, x+4, 1))) If Left(flag, 1) = '1' then , attr = 'Reentrant ' Else , attr = '' If Substr(flag, 2,1) = '1' then , attr = attr||'Reusable ' If Substr(flag, 7,1) = '0' then , attr = attr||'Non-executable ' flag = X2B(C2X(Substr(buff, x+5, 1))) If Right(flag, 1) = '1' then , attr = attr||'Refreshable ' If Substr(flag,5,1) = '1' then , attr = attr||'Non-editable ' flag = X2B(C2X(Substr(buff, x+6, 1))) If Substr(flag, 3,1) = '1' then , attr = attr||'Page-aligned ' If Substr(flag, 4,1) = '1' then , ssi = C2X(Substr(buff, x+22, 4)) else ssi = '' If Substr(flag, 5,1) = '1' then , ac = C2D(Substr(buff, x+9, 1)) else ac = 0 If Substr(flag, 6,1) = '1' then , pmarl = 1 else pmarl = 0 flag = X2B(C2X(Substr(buff, x+7, 1))) Say 'Attributes: 'attr If Substr(flag, 4,1) = '1' then , Say 'Rmode ANY' Amode = Right(flag, 2) Select When Amode = '00' then Say 'Amode 24' When Amode = '10' then Say 'Amode 31' When Amode = '11' then Say 'Amode ANY' Otherwise Say 'Invalid Amode flag 'Amode End If ac \= 0 then , Say 'Auth code = 'ac If ssi \= '' then , Say 'SSI='ssi size = C2D(Substr(buff, x+10, 4)) Say 'Load module size 'size ep = C2X(Substr(buff, x+18, 4)) Say 'Entry point at 'ep 'close' fd If retval = -1 then Say 'Error 'errno errnojr /* PMARL follows PMAR */ If pmarl then , Say 'Program object' Else Do Say 'PMARL not present' Exit 4 End len = C2D(Substr(buff, x+30, 2)) flag = X2B(C2X(Substr(buff, x+32, 1))) If Left(flag,1) = '1' then , Say 'Must be stored in a PDSE' If len >= 74 then Do date = C2X(Substr(buff, x+96, 4)) Say 'Date stored 'Left(date,4)'.'Substr(date,5,3) time = C2X(Substr(buff, x+100, 4)) Say 'Time stored 'Substr(time,2,2)':'Substr(time,4,2)':'Substr(time,6,2) End If len < 82 then , Say 'Length of PMARL = 'len Else , Say 'Created by 'Substr(buff, x+104, 8) Exit 0