/* $VER: pkginfo 0.3 $ */ /* information about AppleLink package */ /* © by Stefan Haubenthal 1997/98 */ if ~arg() then exit 0*writeln(stdout,"Usage: pkginfo name[.pkg]") if ~open(file,arg(1)) then call open(file,arg(1)".pkg") if ~abbrev(readch(file,8),"package") then exit 10 call seek(file,4)/* xxxx */ say "packageFlags: "c2d(readch(file,4)) say "versionNo: "c2d(readch(file,4)) call seek(file,2)/* \0\0 */ acl=c2d(readch(file,2)) say "authorCopyrightLength: "acl call seek(file,2) pnl=c2d(readch(file,2)) say "packageNameLength: "pnl say "packageLength: "c2d(readch(file,4)) say "createdTimeStamp: "c2d(readch(file,4)) say "modifiedTimeStamp: "c2d(readch(file,4)) call seek(file,4)/* \0\0\0\0 */ fro=c2d(readch(file,4)) say "firstRecordOffset: "fro say "partCount: "c2d(readch(file,4)) say call seek(file,4)/* \0\0\0\0 */ say "partOffset: "c2d(readch(file,4)) say "lengthOfData: "c2d(readch(file,4)) say "partType: "readch(file,4) call seek(file,4)/* \0\0\0\0 */ call seek(file,4)/* \0\0\0 0x81 */ say "partStringOffset: "c2d(readch(file,2)) say "partStringLength: "c2d(readch(file,2)) call seek(file,4)/* \0\0\0\0 */ say say readch(file,acl) say readch(file,pnl) say call seek(file,fro,B) do forever len=c2d(readch(file,3)) if eof(file) then leave type=readch(file) say type len call seek(file,4)/* \0\0\0\0 */ rec=readch(file,len-8) if len>65535 then call seek(file,len-8-65535) if len//8>0 then call seek(file,8-len//8) select when type=@ then call data when type=A then call array when type=C then call frame end end exit DATA: class=c2x(left(rec,4)) select when class="00055552" then say class substr(rec,9) when class="0000064D" then say class translate(substr(rec,5),copies("7f"x,31),xrange("01"x,"1f"x)) otherwise say class end return ARRAY: return FRAME: return