home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cppdesk.zip / CPPDESK.CMD
OS/2 REXX Batch file  |  1993-11-03  |  28KB  |  721 lines

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*                                                                         */
  4. /* CCPDESK.CMD                 Version 1.0                                 */
  5. /*                                                                         */
  6. /* Function:                                                               */
  7. /*      Build the WPS entries for the following products:                  */
  8. /*              IBM CSet/2 Compiler                                        */
  9. /*              ON-Line Text                                               */
  10. /*              C Samples : Not Yet                                        */
  11. /*              Updates the CONFIG.SYS                                     */
  12. /*                                                                         */
  13. /* Note:                                                                   */
  14. /*       Heavily based upon the TK21DESK.CMD that ships with Toolkit 2.1   */
  15. /*                                                                         */
  16. /* Parameters:                                                             */
  17. /*      None                                                               */
  18. /*                                                                         */
  19. /* Author:                                                                 */
  20. /*      Joe Magrino                                                        */
  21. /*                                                                         */
  22. /***************************************************************************/
  23.  
  24. Trace 'O'
  25. Address CMD
  26. '@ECHO OFF'
  27.  
  28. /**************/
  29. /* Initialize */
  30. /**************/
  31. Call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  32. Call sysloadfuncs
  33.  
  34. iccdrive = ''
  35. iccpath = ''
  36. bootdrive = Substr(Translate(Value('PATH',,'OS2ENVIRONMENT')),Pos('\OS2\SYSTEM',,
  37.                    Translate(Value('PATH',,'OS2ENVIRONMENT')))-2,2)
  38.  
  39. /*****************************************************************************/
  40. /*        Getting the Toolkit 2.1 drive & path                               */
  41. /*****************************************************************************/
  42. If Pos('\IBMCPP',Translate(Value('PATH',,'OS2ENVIRONMENT'))) > 0 Then iccdrive = Translate(Substr(Value('PATH',,'OS2ENVIRONMENT'),Pos('\IBMCPP',Translate(Value('PATH',,'OS2ENVIRONMENT')))-2,2))
  43. If iccdrive = '' Then Do
  44.   Say "No path found for the OS/2 IBM CSet/2 Compiler, please enter the drive."
  45.   Say "Example) C:"
  46.   Parse Upper Pull iccdrive
  47.   iccpath=iccdrive||"\IBMCPP"
  48.  
  49.   Say "OS/2 IBM CSet/2 Compiler DRIVE =" iccdrive
  50.   Say "OS/2 IBM CSet/2 Compiler PATH =" iccpath
  51.   Say "Is OS/2 IBM CSet/2 Compiler in drive" iccdrive"?(Y/N)"
  52.   Parse Upper Pull response
  53.   If response <> 'Y' Then Do
  54.      iccdrive = ''
  55.      Say "Re-enter the Drive that contains OS/2 IBM CSet/2 Compiler."
  56.      Parse Upper Pull iccdrive
  57.  
  58.      iccpath = iccdrive||'\IBMCPP'
  59.   End
  60. End
  61. Else Do
  62.   Say "Path found for the OS/2 IBM CSet/2 Compiler."
  63.   iccpath = iccdrive||'\IBMCPP'
  64.  
  65.   Say "OS/2 IBM CSet/2 Compiler DRIVE =" iccdrive
  66.   Say "OS/2 IBM CSet/2 Compiler PATH =" iccpath
  67.   Say "Is OS/2 IBM CSet/2 Compiler information correct?(Y/N)"
  68.   Parse Upper Pull response
  69.   If response <> 'Y' Then Do
  70.      iccdrive = ''
  71.      Say "Re-enter the Drive that contains IBM CSet/2 Compiler."
  72.      Parse Upper Pull iccdrive
  73.  
  74.      iccpath = iccdrive||'\IBMCPP'
  75.   End
  76. End
  77.  
  78. Do Until file.0 <> 0
  79.    ret = SysFileTree(iccpath, 'file', 'D')
  80.  
  81.    If file.0 = 0 Then Do
  82.       'CLS'
  83.       Say "The OS/2 IBM CSet/2 Compiler is not in drive" iccdrive"."
  84.       Say "Do you want to exit from IBM CSet/2 Compiler installation?(Y/N)"
  85.       Parse Upper Pull response
  86.       If Substr(response,1,1) = 'Y' Then Call Endit
  87.  
  88.       iccdrive=''
  89.       Say "Please re-enter the drive for OS/2 IBM CSet/2 Compiler."
  90.       Say "Example) C:"
  91.       Parse Upper Pull iccdrive
  92.       iccpath=iccdrive||"\IBMCPP"
  93.  
  94.       Say "OS/2 IBM CSet/2 Compiler DRIVE =" iccdrive
  95.       Say "OS/2 IBM CSet/2 Compiler PATH =" iccpath
  96.       Say "Is OS/2 IBM CSet/2 Compiler in drive" iccdrive"?(Y/N)"
  97.       Parse Upper Pull response
  98.       If response <> 'Y' Then Do
  99.          iccdrive = ''
  100.          Say "Re-enter the Drive that contains OS/2 IBM CSet/2 Compiler."
  101.          Parse Upper Pull iccdrive
  102.          iccpath = iccdrive||'\IBMCPP'
  103.       End  /* If */
  104.    End  /* If */
  105. End /* do */
  106.  
  107.  
  108. /*****************************************************************************/
  109. /*    Ask User for CSet/2 Compiler drive if there is no                      */
  110. /*    CSet/2 Compiler info in system                                         */
  111. /*****************************************************************************/
  112.  
  113. 'CLS'
  114. Say "Your OS/2 system is installed on the" bootdrive "drive."
  115. Say " "
  116. Say "The OS/2 IBM CSet/2 Compiler components have been found:"
  117. Say " "
  118. If iccdrive <> '' Then Say "     OS/2 IBM CSet/2 Compiler is in" iccpath
  119. Say " "
  120. Say "This program will now create a folder for OS/2 IBM CSet/2 Compiler and"
  121. Say "its identified components on your desktop."
  122. Say " "
  123. Say "Do you want to continue (Y/N)?"
  124. Parse Upper Pull yesno .
  125. If Substr(yesno,1,1) <> 'Y' Then Call Endit
  126.  
  127. /*****************************************************************************/
  128. /*        Define & Create the Toolkit Folder for the IBM CSet/2 Compiler     */
  129. /*****************************************************************************/
  130.  
  131. If iccdrive <> '' Then Do
  132.   Call SysCreateObject 'WPFolder', 'IBM C/C++ Tools 2.0 ','<WP_DESKTOP>',,
  133.      'OBJECTID=<ICC_IBMCPP>;ICONVIEW=FLOWED;ICONFILE='||iccpath||'\CPP.ICO;BACKGROUND='||iccpath||'\CPP.BMP','R'
  134.  
  135. /*****************************************************************************/
  136. /*        Create Reference Program ICONs in C++ Info Folder                  */
  137. /*****************************************************************************/
  138.  
  139.   Call SysCreateObject 'WPProgram','Browser Tutorial','<ICC_IBMCPP>','OBJECTID=<ICC_IBRSREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=DDE4BTUT.INF;STARTUPDIR='||iccpath||'\HELP;','R'
  140.   Call SysCreateObject 'WPProgram','Class Library: Collection^Classes Reference','<ICC_IBMCPP>','OBJECTID=<ICC_CCLREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=DDE4CCL.INF;STARTUPDIR='||iccpath||'\HELP;','R'
  141.   Call SysCreateObject 'WPProgram','C Library^Reference','<ICC_IBMCPP>','OBJECTID=<ICC_CLIBREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=DDE4CLIB.INF;STARTUPDIR='||iccpath||'\HELP;','R'
  142.   Call SysCreateObject 'WPProgram','C/C++ Language^Reference','<ICC_IBMCPP>','OBJECTID=<ICC_LRMREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=DDE4LRM.INF;STARTUPDIR='||iccpath||'\HELP;','R'
  143.   Call SysCreateObject 'WPProgram','Standard Class^Library Reference','<ICC_IBMCPP>','OBJECTID=<ICC_SCLREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=DDE4SCL.INF;STARTUPDIR='||iccpath||'\HELP;','R'
  144.   Call SysCreateObject 'WPProgram','Class Library: User^Interface Reference','<ICC_IBMCPP>','OBJECTID=<ICC_UILREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=DDE4UIL.INF;STARTUPDIR='||iccpath||'\HELP;','R'
  145.   Call SysCreateObject 'WPProgram','Debugger Tutorial','<ICC_IBMCPP>','OBJECTID=<ICC_TMSTREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=DDE4TMST.INF;STARTUPDIR='||iccpath||'\HELP;','R'
  146.   Call SysCreateObject 'WPProgram','IBM C/C++ Tools^Compiler Utility Reference','<ICC_IBMCPP>','OBJECTID=<ICC_UTILREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=DDE4UTIL.INF;STARTUPDIR='||iccpath||'\HELP;','R'
  147.   Call SysCreateObject 'WPProgram','IBM C/C++ Tools^Readme','<ICC_IBMCPP>','OBJECTID=<ICC_README>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=README.INF;STARTUPDIR='||iccpath||'\HELP;','R'
  148.  
  149. /*****************************************************************************/
  150. /*        Create Utility ICONs                                               */
  151. /*****************************************************************************/
  152.  
  153.   Call SysCreateObject 'WPProgram','IBM C/C++ Tools^2.0 Window','<ICC_IBMCPP>',,
  154.       'OBJECTID=<ICC_IBMCPPWIN>;EXENAME=*;PROGTYPE=WINDOWABLEVIO;PARAMETERS=/K '||iccpath||'\BIN\CSETENV.CMD;STARTUPDIR='||iccpath||'\BIN;','R'
  155.  
  156.   Call SysCreateObject 'WPProgram','C++ Browser','<ICC_IBMCPP>','OBJECTID=<ICC_IBRS>;EXENAME='||iccpath||'\BIN\IBRS.EXE;PROGTYPE=PM;STARTUPDIR='||iccpath||'\BIN;','R'
  157.   Call SysCreateObject 'WPProgram','Execution Analyzer','<ICC_IBMCPP>','OBJECTID=<ICC_IXTRA>;EXENAME='||iccpath||'\BIN\IXTRA.EXE;PROGTYPE=PM;STARTUPDIR='||iccpath||'\BIN;','R'
  158.   Call SysCreateObject 'WPProgram','PM Debugger','<ICC_IBMCPP>','OBJECTID=<ICC_IDCIPMD>;EXENAME='||iccpath||'\BIN\IPMD.EXE;PROGTYPE=PM;STARTUPDIR='||iccpath||'\BIN;','R'
  159. /*
  160.   Call SysCreateObject 'WPProgram','Dynamic Call Graph','<ICC_IBMCPP>','OBJECTID=<ICC_IDCGRAPH>;EXENAME='||iccpath||'\BIN\IDCGRAPH.EXE;PROGTYPE=PM;STARTUPDIR='||iccpath||'\BIN;','R'
  161.   Call SysCreateObject 'WPProgram','Statics','<ICC_IBMCPP>','OBJECTID=<ICC_ISTATS>;EXENAME='||iccpath||'\BIN\ISTATS.EXE;PROGTYPE=PM;STARTUPDIR='||iccpath||'\BIN;','R'
  162.   Call SysCreateObject 'WPProgram','Time Line','<ICC_IBMCPP>','OBJECTID=<ICC_ITIME>;EXENAME='||iccpath||'\BIN\ITIME.EXE;PROGTYPE=PM;STARTUPDIR='||iccpath||'\BIN;','R'
  163. */
  164.  
  165. /*****************************************************************************/
  166. /*        Update the CONFIG.SYS                                              */
  167. /*****************************************************************************/
  168.   Call Tk21ChgConfig
  169.  
  170. End
  171.  
  172.  
  173. /****************/
  174. /* Exit program */
  175. /****************/
  176. Endit:
  177. Exit 0
  178.  
  179. /***************************/
  180. /* Change the CONFIG.SYS   */
  181. /***************************/
  182.  
  183. Tk21ChgConfig:   /* change the config.sys file for IBM CSet/2 Compiler */
  184.  
  185. '@cls'
  186. response=''
  187.  
  188. oldconfig=bootdrive'\CONFIG.SYS'
  189. newconfig=bootdrive'\CONFIG.CPP'
  190. tmpconfig=bootdrive'\TMP.SYS'
  191.  
  192. Say '    Do you want to update 'oldconfig'?(Y/N)'
  193.   Parse Upper Pull response
  194.   If response <> 'N' Then Do
  195.      Say '    The old 'oldconfig 'will be copied to 'newconfig
  196.      Say ' '
  197.      Say '    Shutdown and restart your system for these changes to take affect.'
  198.      Say ' '
  199.   End
  200.   Else
  201.      return 0
  202.  
  203.  
  204. os2path='SET PATH'
  205. os2dpath='SET DPATH'
  206. os2libpath='LIBPATH'
  207. os2help='SET HELP'
  208. os2bookshelf='SET BOOKSHELF'
  209. os2include='SET INCLUDE'
  210. os2lib='SET LIB'
  211.  
  212. includeflag=0
  213. libflag=0
  214.  
  215. /* get the portion of pathspec without the [drive]: */
  216. pathonly = right(iccpath, length(iccpath)-2)
  217.  
  218. /*
  219.  * read the file one line at a time, and write it all out, making
  220.  * changes accordingly - need to change path, libpath, help, bookshelf
  221.  * ipfc, include, lib
  222.  */
  223.  
  224. '@del 'newconfig ' 2>nul >nul'
  225.  
  226. Do while lines(oldconfig)
  227.     inline=linein(oldconfig)
  228.  
  229.     /******************************************/
  230.     /* parse the line into variable and value */
  231.     /******************************************/
  232.  
  233.     parse value inline with os2var '=' os2value
  234.  
  235.     /********************************************************/
  236.     /* translate the variable into uppercase for comparison */
  237.     /********************************************************/
  238.  
  239.     os2var=translate(os2var)
  240.     Select
  241.  
  242.         /********************************************************/
  243.         /*          For PATH                                    */
  244.         /********************************************************/
  245.         when os2var=os2path Then Do
  246.             cppline=inline
  247.  
  248.             /* see if path is already set */
  249.             k = pos(pathonly'\BIN', translate(cppline))
  250.             If k = 0 Then Do
  251.                /* See if CSet/1.0 exist */
  252.                t = pos('\IBMC\BIN', translate(os2value))
  253.  
  254.                If t <> 0 Then Do
  255.                   l=length(iccpath'BIN;')
  256.                   cppline=os2var'='Insert(iccpath'\BIN;', os2value, t-3, l)
  257.                End
  258.                Else Do
  259.                   /*
  260.                    * see if there is a ; at the end of the value
  261.                    */
  262.                   position=lastpos(';',os2value)
  263.                   lenvalue=length(os2value)
  264.  
  265.                   If position=lenvalue Then do
  266.                       /* ; at end of value */
  267.                       cppline=os2var'='os2value''iccpath'\BIN;'
  268.                   End
  269.                   Else Do
  270.                       /* ; NOT at end of value */
  271.                       cppline=os2var'='os2value';'iccpath'\BIN;'
  272.                   End
  273.                End
  274.             End
  275.             Else  /* see if the drive letter is not the same */
  276.               If substr(cppline, k-2, 1) \= iccdrive Then
  277.                 /* change the drive letter only */
  278.                 cppline = overlay(iccdrive, cppline, k-2)
  279.  
  280.             /*
  281.              * write the line out to the new config file
  282.              */
  283.  
  284.             result=lineout(newconfig, cppline)
  285.  
  286.             If result=1 Then Do
  287.                 writeerror()
  288.                 return 1
  289.             End
  290.         End
  291.  
  292.         /********************************************************/
  293.         /*          For LIBPATH                                 */
  294.         /********************************************************/
  295.         when os2var=os2libpath Then Do
  296.             cppline=inline
  297.  
  298.             /* see if lib path is already set */
  299.             k = pos(pathonly'\DLL', translate(cppline))
  300.             If k = 0 Then Do
  301.                /* See if IBM CSet/1.0 exist */
  302.                t = pos('\IBMC\DLL', translate(os2value))
  303.  
  304.                If t <> 0 Then Do
  305.                   l=length(iccpath'\DLL;')
  306.                   cppline=os2var'='Insert(iccpath'\DLL;', os2value, t-3, l)
  307.                End
  308.                Else Do
  309.                   /*
  310.                    * see if there is a ; at the end of the value
  311.                    */
  312.  
  313.                   position=lastpos(';',os2value)
  314.                   lenvalue=length(os2value)
  315.  
  316.                   If position=lenvalue Then Do
  317.                       /* ; at end of value */
  318.                       cppline=os2var'='os2value''iccpath'\DLL;'
  319.                   End
  320.                   Else Do
  321.                       /* ; NOT at end of value */
  322.                       cppline=os2var'='os2value';'iccpath'\DLL;'
  323.                   End
  324.                End
  325.             End
  326.             Else  /* see if the drive letter is not the same */
  327.               If substr(cppline, k-2, 1) \= iccdrive Then
  328.                 /* change the drive letter only */
  329.                 cppline = overlay(iccdrive, cppline, k-2)
  330.  
  331.             /*
  332.              * write the line out to the new config file
  333.              */
  334.  
  335.             result=lineout(newconfig, cppline)
  336.             If result=1 Then Do
  337.                 writeerror()
  338.                 return 1
  339.             End
  340.         End
  341.  
  342.  
  343.         /********************************************************/
  344.         /*          For DPATH                                   */
  345.         /********************************************************/
  346.         when os2var=os2dpath Then Do
  347.             cppline=inline
  348.  
  349.             /* see if path is already set */
  350.             k = pos(pathonly'\HELP', translate(cppline))
  351.             If k = 0 Then Do
  352.                /* See if CSet/1.0 exist */
  353.                t = pos('\IBMC\HELP', translate(os2value))
  354.  
  355.                If t <> 0 Then Do
  356.                   l=length(iccpath'HELP;')
  357.                   cppline=os2var'='Insert(iccpath'\HELP;', os2value, t-3, l)
  358.                End
  359.                Else Do
  360.                   /*
  361.                    * see if there is a ; at the end of the value
  362.                    */
  363.                   position=lastpos(';',os2value)
  364.                   lenvalue=length(os2value)
  365.  
  366.                   If position=lenvalue Then do
  367.                       /* ; at end of value */
  368.                       cppline=os2var'='os2value''iccpath'\HELP;'
  369.                   End
  370.                   Else Do
  371.                       /* ; NOT at end of value */
  372.                       cppline=os2var'='os2value';'iccpath'\HELP;'
  373.                   End
  374.                End
  375.             End
  376.             Else  /* see if the drive letter is not the same */
  377.               If substr(cppline, k-2, 1) \= iccdrive Then
  378.                 /* change the drive letter only */
  379.                 cppline = overlay(iccdrive, cppline, k-2)
  380.  
  381.             /*
  382.              * write the line out to the new config file
  383.              */
  384.  
  385.             result=lineout(newconfig, cppline)
  386.  
  387.             If result=1 Then Do
  388.                 writeerror()
  389.                 return 1
  390.             End
  391.         End
  392.  
  393.         /********************************************************/
  394.         /*          For SET HELP                                */
  395.         /********************************************************/
  396.         when os2var=os2help Then Do
  397.             cppline=inline
  398.  
  399.             /* see if lib path is already set */
  400.             k = pos(pathonly'\HELP', translate(cppline))
  401.             If k = 0 Then Do
  402.                /* See if IBM CSet/1.0exist */
  403.                t = pos('\IBMC\HELP', translate(os2value))
  404.  
  405.                If t <> 0 Then Do
  406.                   l=length(iccpath'\HELP;')
  407.                   cppline=os2var'='Insert(iccpath'\HELP;', os2value, t-3, l)
  408.                End
  409.                Else Do
  410.                   /*
  411.                    * see if there is a ; at the end of the value
  412.                    */
  413.  
  414.                   position=lastpos(';',os2value)
  415.                   lenvalue=length(os2value)
  416.  
  417.                   If position=lenvalue Then Do
  418.                       /* ; at end of value */
  419.                       cppline=os2var'='os2value''iccpath'\HELP;'
  420.                   End
  421.                   Else Do
  422.                       /* ; NOT at end of value */
  423.                       cppline=os2var'='os2value';'iccpath'\HELP;'
  424.                   End
  425.                End
  426.             End
  427.             Else  /* see if the drive letter is not the same */
  428.               If substr(cppline, k-2, 1) \= iccdrive Then
  429.                 /* change the drive letter only */
  430.                 cppline = overlay(iccdrive, cppline, k-2)
  431.  
  432.             /*
  433.              * write the line out to the new config file
  434.              */
  435.  
  436.             result=lineout(newconfig, cppline)
  437.             If result=1 Then Do
  438.                 writeerror()
  439.                 return 1
  440.             End
  441.         End
  442.  
  443.         /********************************************************/
  444.         /*          For SET BOOKSHELF                           */
  445.         /********************************************************/
  446.         when os2var=os2bookshelf Then Do
  447.             cppline=inline
  448.  
  449.             /* see if bookshelf path is already set */
  450.             k = pos(pathonly'\HELP', translate(cppline))
  451.             If k = 0 Then Do
  452.                /* See if IBM CSet/1.0 exist */
  453.                t = pos('\IBMC\HELP', translate(os2value))
  454.  
  455.                If t <> 0 Then Do
  456.                   l=length(iccpath'\HELP;')
  457.                   cppline=os2var'='Insert(iccpath'\HELP;', os2value, t-3, l)
  458.                End
  459.                Else Do
  460.                   /*
  461.                    * see if there is a ; at the end of the value
  462.                    */
  463.  
  464.                   position=lastpos(';',os2value)
  465.                   lenvalue=length(os2value)
  466.  
  467.                   If position=lenvalue Then Do
  468.                       /* ; at end of value */
  469.                       cppline=os2var'='os2value''iccpath'\HELP;'
  470.                   End
  471.                   Else Do
  472.                       /* ; NOT at end of value */
  473.                       cppline=os2var'='os2value';'iccpath'\HELP;'
  474.                   End
  475.                End
  476.             End
  477.             Else  /* see if the drive letter is not the same */
  478.               If substr(cppline, k-2, 1) \= iccdrive Then
  479.                 /* change the drive letter only */
  480.                 cppline = overlay(iccdrive, cppline, k-2)
  481.  
  482.             /*
  483.              * write the line out to the new config file
  484.              */
  485.  
  486.             result=lineout(newconfig, cppline)
  487.             If result=1 Then Do
  488.                 writeerror()
  489.                 return 1
  490.             End
  491.         End
  492.  
  493.  
  494.         /********************************************************/
  495.         /*          For SET INCLUDE                             */
  496.         /********************************************************/
  497.         when os2var=os2include Then Do
  498.  
  499.             includeflag=1
  500.             cppline=inline
  501.  
  502.             /* see if C\OS2H path is already set */
  503.             k = pos(pathonly'\CPLUS\INCLUDE', translate(cppline))
  504.  
  505.             If k = 0 Then Do
  506.                /* See if IBM CSet/1.0 exist */
  507.                t = pos('\IBMC\INCLUDE', translate(os2value))
  508.  
  509.                If t <> 0 Then Do
  510.                   l=length(iccpath'\C\OS2H;')
  511.                   cppline=os2var'='Insert(iccpath'\CPLUS\INCLUDE;', os2value, t-3, l)
  512.                End
  513.                Else Do
  514.                   /*
  515.                    * see if there is a ; at the end of the value
  516.                    */
  517.  
  518.                   position=lastpos(';',os2value)
  519.                   lenvalue=length(os2value)
  520.  
  521.                   If position=lenvalue Then Do
  522.                       /* ; at end of value */
  523.                       cppline=os2var'='os2value''iccpath'\CPLUS\INCLUDE;'
  524.                   End
  525.                   Else Do
  526.                       /* ; NOT at end of value */
  527.                       cppline=os2var'='os2value';'iccpath'\CPLUS\INCLUDE;'
  528.                   End
  529.                End
  530.             End
  531.             Else  /* see if the drive letter is not the same */
  532.               If substr(cppline, k-2, 1) \= iccdrive Then
  533.                 /* change the drive letter only */
  534.                 cppline = overlay(iccdrive, cppline, k-2)
  535.  
  536.             /*
  537.              * write the line out to the new config file
  538.              */
  539.  
  540.             result=lineout(newconfig, cppline)
  541.             If result=1 Then Do
  542.                 writeerror()
  543.                 return 1
  544.             End
  545.         End
  546.  
  547.         /********************************************************/
  548.         /*          For SET LIB                                 */
  549.         /********************************************************/
  550.  
  551.         when os2var=os2lib Then Do
  552.             libflag=1
  553.  
  554.             cppline=inline
  555.  
  556.             /* see if lib path is already set */
  557.             k = pos(pathonly'\LIB', translate(cppline))
  558.             If k = 0 Then Do
  559.                /* See if IBM CSET/1.0 exist */
  560.                t = pos('\IBMC\LIB', translate(os2value))
  561.  
  562.                If t <> 0 Then Do
  563.                   l=length(iccpath'\LIB;')
  564.                   cppline=os2var'='Insert(iccpath'\LIB;', os2value, t-3, l)
  565.                End
  566.                Else Do
  567.                   /*
  568.                    * see if there is a ; at the end of the value
  569.                    */
  570.  
  571.                   position=lastpos(';',os2value)
  572.                   lenvalue=length(os2value)
  573.  
  574.                   If position=lenvalue Then Do
  575.                       /* ; at end of value */
  576.                       cppline=os2var'='os2value''iccpath'\LIB;'
  577.                   End
  578.                   Else Do
  579.                       /* ; NOT at end of value */
  580.                       cppline=os2var'='os2value';'iccpath'\LIB;'
  581.                   End
  582.                End
  583.             End
  584.             Else  /* see if the drive letter is not the same */
  585.               If substr(cppline, k-2, 1) \= iccdrive Then
  586.                 /* change the drive letter only */
  587.                 cppline = overlay(iccdrive, cppline, k-2)
  588.  
  589.             /*
  590.              * write the line out to the new config file
  591.              */
  592.  
  593.             result=lineout(newconfig, cppline)
  594.             If result=1 Then Do
  595.                 writeerror()
  596.                 return 1
  597.             End
  598.         End
  599.  
  600.         otherwise Do
  601.             /*
  602.              * write the line out to the new config file
  603.              */
  604.  
  605.             result=lineout(newconfig, inline)
  606.             If result=1 Then Do
  607.                 writeerror()
  608.                 return 1
  609.             End
  610.         End
  611.  
  612.     End  /* select */
  613.  
  614. End /* Do */
  615.  
  616. /******************************************************************/
  617. /* if there was no SET INCLUDE variable set in CONFIG.SYS, Then   */
  618. /* put New env. variables                                         */
  619. /******************************************************************/
  620.  
  621. If includeflag=0 Then Do
  622.  
  623.     cppline='SET INCLUDE='iccpath'\C\OS2H;'iccpath'\C\OS2H\VDD;'iccpath'\ASM\OS2INC;'
  624.  
  625.     /*
  626.      * write the line out to the new config file
  627.      */
  628.  
  629.     result=lineout(newconfig, cppline)
  630.     If result=1 Then Do
  631.         writeerror()
  632.         return 1
  633.     End
  634. End
  635.  
  636. /******************************************************************/
  637. /* if there was no SET LIB variable set in CONFIG.SYS, Then       */
  638. /* put New env. variables                                         */
  639. /******************************************************************/
  640.  
  641. If libflag=0 Then Do
  642.  
  643.     cppline='SET LIB='iccpath'\OS2LIB;'
  644.  
  645.     /*
  646.      * write the line out to the new config file
  647.      */
  648.  
  649.     result=lineout(newconfig, cppline)
  650.     If result=1 Then Do
  651.         writeerror()
  652.         return 1
  653.     End
  654. End
  655. /*********************/
  656. /* close the files   */
  657. /*********************/
  658.  
  659. result=lineout(newconfig)
  660. result=lineout(oldconfig)
  661.  
  662. /******************************************************************/
  663. /* Copy created file(CONFIG.TKT) to temporary file(TMP.SYS),      */
  664. /* copy original file(CONFIG.SYS) to new file(CONFIG.TKT),        */
  665. /* and copy temporary file(TMP.SYS) to original file(CONFIG.SYS). */
  666. /******************************************************************/
  667.  
  668. '@copy 'oldconfig' 'tmpconfig' 2>nul >nul'
  669.  
  670. '@copy 'newconfig' 'oldconfig' 2>nul >nul'
  671.  
  672. '@copy 'tmpconfig' 'newconfig' 2>nul >nul'
  673.  
  674. '@del 'tmpconfig' 2>nul >nul'
  675. /******************************************************************/
  676. /*  Finished the Update                                           */
  677. /******************************************************************/
  678.  
  679. Say ' '
  680. Say '               'bootdrive'\CONFIG.SYS updated succesfully.'
  681. Say ' '
  682.  
  683. return 0
  684.  
  685.  
  686. writeerror:         /* display a write error to the screen */
  687.  
  688. '@cls'
  689. Say ' '
  690. Say ' '
  691. Say '                       *****  ERROR  *****'
  692. Say ' '
  693. Say '               An error occured while attempting to write the '
  694. Say '               'bootdrive'\CONFIG.SYS file.  Check the available disk'
  695. Say '               disk space on the current drive and retry the'
  696. Say '               install process.'
  697. Say ' '
  698.  
  699. return 0
  700.  
  701. /********************************/
  702. /* Notify user in case of error */
  703. /********************************/
  704. Telluser: Procedure
  705. Parse source . . tell_name .
  706. tell_name = Filespec('name',tell_name)
  707. Parse Upper Var tell_name tell_name '.' .
  708. ulogfile = tell_name
  709. If Arg(2,'e') = 0 Then Do
  710.   Say tell_name||':' Date('U') Time() Arg(1)
  711. End
  712. Else Do
  713.   If Arg(2) = 0 Then Do
  714.     Say tell_name||':' Date('U') Time() Arg(1)
  715.   End
  716.   Else Do
  717.     Say Copies(' ',15+Length(tell_name)) Arg(1)
  718.   End
  719. End
  720. Return 0
  721.