home *** CD-ROM | disk | FTP | other *** search
- /*
- SOFTWARE INSTALLER EPFLEVEL.CMD 5621-434 (C) COPYRIGHT IBM CORP 1992, 1993. ALL RIGHTS RESERVED. LICENSED MATERIALS - PROPERTY OF IBM.
- */
-
- /******************************************************************************/
- /* epflevel - display file version statistics for Software Installer files... */
- /******************************************************************************/
-
- '@echo off'
-
- parse upper arg fidMask '/' options
-
- /* Check parameters and set defaults... */
- if fidMask = '?' then do
- say ' '
- say 'Display the service level information of Software Installer files.'
- say ' '
- say 'EPFLEVEL file_mask [ /FC ]'
- say ' '
- say 'Where:'
- say ' file_mask is a path and file specification of the file or '
- say ' files for which service information is to be displayed. '
- say ' '
- say ' /FC displays the full copyright statement information.'
- exit
- end
- else
- nop
- copyright = 0
- do while options <> ''
- parse var options option '/' options
- select
- when option = 'FC' then /* Full copyright statements displayed */
- copyright = 1
- otherwise
- do
- say 'Invalid option '''option'''.'
- exit 1
- end
- end
- end
-
- fidMask = strip(fidMask)
- if fidmask = '' | right(fidMask,1) = '\' then do
- saveMask = fidMask
- fidMask = saveMask || 'EPF*'
- call do_prefix 'NO-MESSAGE'
- fidMask = saveMask || 'EHO*'
- call do_prefix 'NO-MESSAGE'
- fidMask = saveMask || 'EWY*'
- call do_prefix 'NO-MESSAGE'
- exit
- end
-
- do_prefix:
- parse arg MessageParm .
- /* Clean out queue... */
- do while queued() <> 0
- parse pull .
- end
-
- /* Put filename(s) into queue... */
- 'dir /f' fidMask '2>nul |rxqueue'
-
- /* Process file(s)... */
- f = 0
- szHeadLast = ''
- do while queued() <> 0
- parse pull fidFull .
-
- /* Non-blank line... */
- if fidFull <> '' then
- do
- /* Query file size... */
- fidSize = stream( fidFull, 'c', 'query size' )
-
- /* Non-directory file... */
- if fidSize <> '' then
- do
- /* Update header if it has changed... */
- szHead = filespec( 'drive', fidFull ) ||,
- translate( filespec( 'path', fidFull ) ) || '..'
- if szHead <> szHeadLast then
- do
- say szHead
- szHeadLast = szHead
- end
- else
- nop
-
- /* Write out data... */
- say '..' || left( translate( filespec( 'name', fidFull ) ), 36 ) ||,
- ' ' || stream( fidFull, 'c', 'query datetime' ) ||,
- ' ' || right( fidSize, 7 )
- if copyright then
- szVer = os2ver( fidFull )
- else
- parse value os2ver( fidFull ) with szVer '(C)' .
- if szVer <> '' then
- say ' ' || szVer
- else
- nop
-
- /* Update found flag... */
- f = 1
- end
-
- /* Directory found (no file size)... */
- else
- nop
- end
-
- /* Blank line... */
- else
- nop
- end
-
- /* Check if any files found... */
- if f = 0 then
- do
- if MessageParm <> 'NO-MESSAGE' then say 'File '''fidMask''' not found.'
- end
- else
- nop
-
- return 0
-
- /*****************************************************************************/
- /* os2ver - return version information from OS/2 files... */
- /*****************************************************************************/
- os2ver: procedure
-
- parse arg fidFull .
-
- /* Extract file extension... */
- parse value translate( filespec( 'name', fidFull ) ) with . '.' fidExt
- do while pos( '.', fidExt ) <> 0
- parse var fidExt . '.' fidExt
- end
-
- sz = ''
-
- /* Process according to file extension... */
- select
- /* .DLL or .EXE file... */
- when wordpos( fidExt, 'DLL EXE EML' ) <> 0 then
- do
- /* EXE header... */
- if charin( fidFull, 1 , 2 ) = 'MZ' then
- do
- /* Offset of OS/2 EXE header... */
- oExe = c2d( reverse( charin( fidFull, 61, 4 ) ) ) + 1
-
- select
- /*┌─────────────────────────────────────────────────────────────┐*/
- /*│ 32-bit OS/2 EXE header... │*/
- /*└─────────────────────────────────────────────────────────────┘*/
- when charin( fidFull, oExe, 2 ) = 'LX' then
- do
- /*┌─────────────────────────────────────────────────────────┐*/
- /*│ Offset/length of DESCRIPTION... │*/
- /*└─────────────────────────────────────────────────────────┘*/
- oDesc = c2d( reverse( charin( fidFull, oExe + 136, 4 ) ) ) + 1
- lDesc = c2d( charin( fidFull, oDesc, 1 ) )
-
- sz = charin( fidFull, oDesc + 1, lDesc )
-
- /*┌─────────────────────────────────────────────────────────┐*/
- /*│ Stop at first line feed... │*/
- /*└─────────────────────────────────────────────────────────┘*/
- i = pos( '0A'x, sz )
- if i <> 0 then
- sz = strip( left( sz, i - 1 ), 'T' )
- end
-
- /*┌─────────────────────────────────────────────────────────────┐*/
- /*│ 16-bit OS/2 EXE header... │*/
- /*└─────────────────────────────────────────────────────────────┘*/
- when charin( fidFull, oExe, 2 ) = 'NE' then
- do
- /*┌─────────────────────────────────────────────────────────┐*/
- /*│ Offset/length of ENTTAB... │*/
- /*└─────────────────────────────────────────────────────────┘*/
- oEnt = oExe + c2d( reverse( charin( fidFull, oExe + 4, 2 ) ) )
- lEnt = c2d( reverse( charin( fidFull, oExe + 6, 2 ) ) )
-
- /*┌─────────────────────────────────────────────────────────┐*/
- /*│ Offset/length of DESCRIPTION... │*/
- /*└─────────────────────────────────────────────────────────┘*/
- oDesc = oEnt + lEnt
- lDesc = c2d( charin( fidFull, oDesc, 1 ) )
-
- sz = charin( fidFull, oDesc + 1, lDesc )
-
- /*┌─────────────────────────────────────────────────────────┐*/
- /*│ Stop at first line feed... │*/
- /*└─────────────────────────────────────────────────────────┘*/
- i = pos( '0A'x, sz )
- if i <> 0 then
- sz = strip( left( sz, i - 1 ), 'T' )
- end
-
- /*┌─────────────────────────────────────────────────────────────┐*/
- /*│ Unrecognized EXE header... │*/
- /*└─────────────────────────────────────────────────────────────┘*/
- otherwise
- sz = ''
- end
- end
-
- /* Non-EXE header... */
- else
- sz = '';
- end
-
- /* .CMD file... */
- when fidExt = 'CMD' | fidExt = 'C' | fidExt = 'H' | fidExt = 'RC' then
- do
- /* Rexx header... */
- if charin( fidFull, 1, 2 ) = '/*' then
- do
- call linein( fidFull )
- sz = linein( fidFull )
- end
-
- /* Non-Rexx header... */
- else
- sz = ''
- end
-
- /* .MAK file... */
- when fidExt = 'MAK' then
- do
- /* MAK Comment... */
- if charin( fidFull, 1, 2 ) = '# ' then
- sz = linein( fidFull )
-
- end
-
- /* .DEF file... */
- when fidExt = 'DEF' then
- do
- /* DEF Comment... */
- if charin( fidFull, 1, 2 ) = '; ' then
- sz = linein( fidFull )
-
- end
-
- /* .HLP file... */
- when fidExt = 'HLP' then
- do
- /* IPF header... */
- if charin( fidFull, 1, 2 ) = 'HS' then
- do
- sz = ''
- c = charin( fidFull, 108, 1 )
- do while c <> '00'x
- sz = sz || c
- c = charin( fidFull )
- end
- end
-
- /* Non-IPF header... */
- else
- sz = ''
- end
-
- /* .MSG file... */
- when fidExt = 'MSG' then
- do
- if charin( fidFull, 1 ) = 'FF'x then
- do
- oMsg = c2d( reverse( charin( fidFull, 32, 2 ) ) )
- sz = ''
- /* c = charin( fidFull, oMsg + 11, 1 ) With message number */
- c = charin( fidFull, oMsg + 2, 1 )
- do while c <> '0D'x
- sz = sz || c
- c = charin( fidFull )
- end
- end
- else
- sz = ''
- end
-
- /* .NLS file or .PKG file... */
- when wordpos( fidExt, 'DAT ICF NLS PKG' ) <> 0 then
- do
- /* Comment header... */
- if charin( fidFull, 1, 2 ) = '* ' then
- sz = linein( fidFull )
-
- /* Non-comment header... */
- else
- sz = ''
- end
-
- /* .SYM file... */
- when fidExt = 'SYM' then
- do
- sz = ''
- c = charin( fidFull, 19, 1 )
- do while c <> '00'x
- sz = sz || c
- c = charin( fidFull )
- end
- end
-
- /* Unknown file extension... */
- otherwise
- do
- 'eautil' fidFull 'ezerlvl.ea /p /r /s 2>nul'
-
- /* Extended attributes found... */
- if rc = 0 & stream( 'ezerlvl.ea', 'c', 'query exists') <> '' then
- do
- /* .VERSION attribute found... */
- if charin( 'ezerlvl.ea', 9, 8 ) = '.VERSION' then
- do
- lVer = c2d( reverse( charin( 'ezerlvl.ea', 20, 2 ) ) )
- sz = charin( 'ezerlvl.ea', 22, lVer )
- end
-
- /* No .VERSION attribute found... */
- else
- sz = ''
-
- call stream 'ezerlvl.ea', 'c', 'close'
- 'erase ezerlvl.ea'
- end
-
- /* No extended attributes found... */
- else
- sz = ''
- end
-
- end
-
- /* Close file... */
- call stream fidFull, 'c', 'close'
-
- return sz