home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / pmsock01.zip / socklib.cmd < prev   
OS/2 REXX Batch file  |  1994-09-23  |  1KB  |  46 lines

  1. /* Make so32dll.a and tcp32dll.a from .dlls 
  2.  
  3.   IBM's TCP .dlls define each funtion twice, so we'll just duplicate
  4.    each line of the output from EMXIMP 
  5.  
  6.   requires: IMPLIB - to create .lib from .dll
  7.           EMXIMP - to create .imp from .lib, and .a from .imp
  8. */             
  9. /* parameters: socklib <tcpdir> <lib>*/
  10. arg tcpdir lib
  11.  
  12. /* make initial lib file, note: it can't be used for linking */
  13. say "Creating LIB file.."
  14. '@implib 'lib'.lib 'tcpdir'\dll\'lib'.dll>nul'
  15.  
  16. /* convert from lib to def format */
  17. say "Creating IMP file.."
  18. '@emximp -o 'lib'.imp 'lib'.lib'
  19. '@if exist 'lib'.tmp del 'lib'.tmp>nul'
  20. '@rename 'lib'.imp 'lib'.tmp>nul'
  21.  
  22. say "Parsing IMP file.."
  23. /* parse imp file, duplicating lines to lowercase */
  24. file=lib'.tmp'
  25. impfile=lib'.imp'
  26.  
  27. '@if exist 'impfile' del 'impfile'>nul'
  28.  
  29. line=linein(file)
  30. do while left(line,1)=';'
  31.   call lineout impfile, line 
  32.   line=linein(file)
  33. end 
  34. do while lines(file)<>0
  35.   call lineout impfile, line
  36.   call lineout impfile, translate(line, 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
  37.   line=linein(file)
  38. end
  39. /* convert .imp to .a for use in linking */
  40.  
  41. say "Creating library.."
  42. '@emximp -o 'lib'.a 'lib'.imp'
  43.  
  44. /* cleanup tmp & invalid files */
  45. say "Done!"
  46.