home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pasos2b.zip / emxrt.zip / emx / bin / emxrev.cmd < prev   
OS/2 REXX Batch file  |  1993-07-03  |  3KB  |  108 lines

  1. /* emxrev.cmd */
  2.  
  3.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  4.   call SysLoadFuncs
  5.  
  6.   parse arg arg1 rest
  7.   select
  8.   when arg1 = '' then do
  9.     say revision( 'emx')
  10.     say revision( 'emxio')
  11.     say revision( 'emxlibc')
  12.     say revision( 'emxwrap')
  13.   end
  14.   when arg1 = '-a' then do
  15.     if rest \= '' then
  16.       call usage
  17.     call find_all
  18.   end
  19.   when arg1 = '-c' then do
  20.     if (rest = '') | (words( rest) > 1) then
  21.       call usage
  22.     parse var rest drive':'rest
  23.     if (length( drive) \= 1) | (rest \= '') then
  24.       call usage
  25.     call find_tree( drive':')
  26.   end
  27.   when arg1 = '-d' then do
  28.     if (rest = '') | (words( rest) > 1) then
  29.       call usage
  30.     call find_dir( rest)
  31.   end
  32.   when arg1 = '-f' then do
  33.     if (rest = '') | (words( rest) > 1) then
  34.       call usage
  35.     say revision( rest)
  36.   end
  37.   when arg1 = '-p' then do
  38.     if (rest = '') | (words( rest) > 1) then
  39.       call usage
  40.     call find_config rest
  41.   end
  42.   otherwise
  43.     call usage
  44.   end
  45.   exit 0
  46.  
  47. usage:
  48.   say 'Usage:'
  49.   say '  emxrev           Display revision number of default emx DLLs'
  50.   say '  emxrev -a        Scan all disks for emx DLLs'
  51.   say '  emxrev -c d:     Scan complete drive D: for emx DLLs'
  52.   say '  emxrev -d dir    Scan directory DIR for emx DLLs'
  53.   say '  emxrev -f file   Display revision number of FILE'
  54.   say '  emxrev -p file   Scan directories in LIBPATH statement of FILE'
  55.   say ''
  56.   say 'emx DLLs are emx.dll, emxio.dll, emxlibc.dll and emxwrap.dll'
  57. exit 1
  58.  
  59. find_all: procedure
  60.   drives = SysDriveMap()
  61.   do i = 1 to words( drives)
  62.     call find_tree( word( drives, i))
  63.   end
  64.   return
  65.  
  66. find_tree: procedure
  67.   arg drive
  68.   call find_dir drive'\'
  69.   return
  70.  
  71. find_dir: procedure
  72.   arg dir
  73.   last = right( dir, 1)
  74.   if (last \= '/') & (last \= '\') & (last \= ':') then
  75.     dir = dir'\'
  76.   call SysFileTree dir'emx*.dll', files, 'FSO'
  77.   do i = 1 to files.0
  78.     name = filespec( 'name', files.i)
  79.     if (name = 'EMX.DLL') | (name = 'EMXIO.DLL') | (name = 'EMXLIBC.DLL'),
  80.        | (name = 'EMXWRAP.DLL') then
  81.       say revision( files.i)
  82.   end
  83.   return
  84.   
  85. find_config: procedure
  86.   arg config
  87.   call SysFileSearch 'LIBPATH=', config, lines
  88.   do i = 1 to lines.0
  89.     parse var lines.i 'LIBPATH='rest
  90.     list = translate( rest, ' ', ';')
  91.     do j = 1 to words( list)
  92.       call find_dir word( list, j)
  93.     end
  94.   end
  95.   return
  96.  
  97. revision: procedure
  98.   arg pathname
  99.   call RxFuncAdd emx_revision, pathname, emx_revision
  100.   signal on syntax name error
  101.   tmp = emx_revision()
  102.   signal off syntax
  103.   call RxFuncDrop emx_revision
  104.   return pathname ': revision =' tmp
  105.  
  106. error:
  107.   return pathname ': revision number not available'
  108.