home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / uilbld.zip / GETOBJS.CMD < prev    next >
OS/2 REXX Batch file  |  1993-09-23  |  2KB  |  76 lines

  1. /* Rexx */
  2.  
  3. /* GETOBJS.CMD <LIB file>
  4.  *
  5.  * Extracts all .obj files from <LIB file>
  6.  *
  7.  * Example:
  8.  *   GETOBJS DDE4MUIB.LIB - extracts all .obj files and writes
  9.  *                          them to the current directory
  10.  */
  11.  
  12. /*
  13.  * COPYRIGHT:                                                                   
  14.  *   Licensed Materials - Property of IBM                                       
  15.  *   (C) Copyright IBM Corporation 1992, 1993                                   
  16.  *   All Rights Reserved                                                        
  17.  *   US Government Users Restricted Rights - Use, duplication, or               
  18.  *   disclosure                                                                 
  19.  *   restricted by GSA ADP Schedule Contract with IBM Corp.                     
  20.  */                                                                             
  21.  
  22.  
  23. signal on error
  24. signal on novalue
  25.  
  26. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  27. call SysLoadFuncs
  28.  
  29. parse arg libFile .
  30.  
  31. if libFile = '' then do
  32.    say "You must supply the name of the Lib file"
  33.    exit 1
  34. end  /* Do */
  35.  
  36. rc = stream(libFile, 'c', 'open read')
  37. if rc \= "READY:" then DO
  38.    say "Can't open" libFile "for input"
  39.    say "Reason:" rc
  40.    exit 2
  41. end  /* Do */
  42. rc = stream(libFile, 'c', 'close')
  43.  
  44. tmpFile = SysTempFileName("getobj??.???")
  45.  
  46. rspFile = SysTempFileName("libresp.???")
  47.  
  48. rc = stream(rspFile, 'c', 'open write')
  49. if rc \= "READY:" then DO
  50.    say "Can't open" rspFile "for output"
  51.    say "Reason:" rc
  52.    exit 3
  53. end  /* Do */
  54.  
  55. "lib" libFile ","tmpFile";"
  56.  
  57. rc = lineout(rspFile, libFile)
  58.  
  59. do while lines(tmpFile)
  60.   curLine = linein(tmpFile)
  61.   if pos("(OFFSET:0x", curLine) > 0  then do
  62.     parse var curLine . ":" objName .
  63.     if objName \= "icopyrit" then
  64.       rc = lineout(rspFile, "*"objName" &")
  65.   end
  66. end /* do */
  67.  
  68. rc = lineout(rspFile, ";")
  69. rc = stream(rspFile, 'c', 'close')
  70. rc = stream(tmpFile, 'c', 'close')
  71.  
  72. "lib @"rspFile
  73.  
  74. rc = SysFileDelete(tmpFile)
  75. rc = SysFileDelete(rspFile) 
  76.