DECUS Essential Tools Collection, 1996 for OpenVMS Alpha and OpenVMS VAX (VS0174)


(c) Copyright 1996, Chris Olive
------------------------------------------------------------------------------

IMGID was created because  very  often  I  wanted  to  see  the  image  header
identification   area   strings,   which   is   commonly  used  to  store  the
identification  or  version  of  an  image  file,   taken   from   the   IDENT
implementations  of  various source compilers.  You can see the same output by
running ANALYZE/IMAGE/INTER  on  the  image  file  in  question  and  pressing
<RETURN>  four  times, but I wanted this information fast and without a lot of
superfluous output.  So, I wrote IMGID.C.

DORK OF THE MONTH

After finishing IMGID.C, I decided to bestow upon  myself  the  "Dork  Of  The
Month"  award  for realizing that I already had a utility to display this sort
of information -- SCAN4.  The "Dork" part comes in here:  I wrote SCAN4!   And
precisely  for  this  very reason, to keep from writing hacks like IMGID.  But
since I had already written it, I thought I'd go ahead and package it  anyway,
which  references to SCAN4 dropped here and there.  SCAN4 scans for exact text
in the output of an DCL or other foreign activated command.   So  IMGID  would
have been as easy as 'SCAN4 "ident" ANALYZE/IMAGE FOO.EXE'.  If you don't have
SCAN4, you  can  get  it  from  ftp://ftp.wku.edu/vms/fileserv/scan4.zip.   It
sounds  like shameless self-promotion, I realize, but get it if you don't have
it, since it'll save you time like I could have saved here.  (SCAN4 does *not*
use  temporary  files to scan output, by the way).  Included here is a wrapper
for getting an image ident using SCAN4 (e.g.  IMGID_USING_SCAN4.DCL).

Not only that, but again writing IMGID in C was  unnecessary  since  the  very
same  information  could  have been obtained a lot easier using plain old DCL!
So I wrote IMGID.DCL, which is included here as well.

Admittedly, writing this in  C  *did*  make  the  output  look  a  lot  nicer.
IMGID.DCL  is  not  able to perform the $ASCTIM service, so the link date/time
from the IHI of an image header was not available.  And using SCAN4, only  the
"ident"  strings  are  displayed.   The nice thing about SCAN4, aside from not
having to write any code, is that SCAN4 should always work on either  platform
(AXP  or  VAX -- assuming the output from ANALYZE/IMAGE doesn't change, but if
it does, just change your scan string -- that's it), whereas  IMGID.C  may  or
may not work on Alphas in the future.  Who knows?

Anyway, here it is, the fast and easy way to  get  the  internal  image  name,
image identification, link date/time, and linker identification from any image
without diving into ANALYZE/IMAGE.  The  C  version  BUILD  command  procedure
takes  into  account  if  you have the GNU C compiler installed and uses GNU C
automatically if you do (since many people use it instead  of  paying  Digital
for a DEC C license!)

After building IMGID, you should set IMGID up as a foreign command so you  can
specify the image filename right on the command line:

$ IMGID :== $ddcu:[directory]IMGID
$ IMGID
Syntax: IMGID <image-filename>
$ IMGID IMGID
Image Header Information for DUA1:[OLIVE.WORK.IMGID]IMGID.EXE;3

        Image Name: "IMGID"
        Image Identification: "V1.0"
        Link Date/Time:  4-MAR-1996 11:20:21.47
        Linker Identification: "05-13"


That's it.  Have fun!

______________________________________________________________________________
Chris Olive
73740.1636@compuserve.com

Click on FTP to download from the FTP archives.
[FTP]