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