home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v5.zip / TOOLKT21 / OS2BIN / TK21DESK.CMD < prev    next >
OS/2 REXX Batch file  |  1993-05-01  |  38KB  |  987 lines

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /* Copyright (c) 1987  - 1992 IBM Corporation                              */
  4. /*                                                                         */
  5. /* TK21DESK.CMD                Version 1.0                                 */
  6. /*                                                                         */
  7. /* Function:                                                               */
  8. /*      Build the WPS entries for the following products:                  */
  9. /*              Development Tool                                           */
  10. /*              ON-Line Text                                               */
  11. /*              C Samples                                                  */
  12. /*              Updates the CONFIG.SYS                                     */
  13. /* Note    :                                                               */
  14. /*                                                                         */
  15. /* Parameters:                                                             */
  16. /*      None                                                               */
  17. /*                                                                         */
  18. /***************************************************************************/
  19.  
  20. Trace 'O'
  21. Address CMD
  22. '@ECHO OFF'
  23.  
  24. /**************/
  25. /* Initialize */
  26. /**************/
  27. Call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  28. Call sysloadfuncs
  29.  
  30. tooldrive = ''
  31. toolpath = ''
  32. bootdrive = Substr(Translate(Value('PATH',,'OS2ENVIRONMENT')),Pos('\OS2\SYSTEM',Translate(Value('PATH',,'OS2ENVIRONMENT')))-2,2)
  33.  
  34. /*****************************************************************************/
  35. /*        Getting the Toolkit 2.1 drive & path                               */
  36. /*****************************************************************************/
  37. If Pos('\TOOLKT21',Translate(Value('PATH',,'OS2ENVIRONMENT'))) > 0 Then tooldrive = Translate(Substr(Value('PATH',,'OS2ENVIRONMENT'),Pos('\TOOLKT21',Translate(Value('PATH',,'OS2ENVIRONMENT')))-2,2))
  38. If tooldrive = '' Then Do
  39.   Say "No path found for the OS/2 Toolkit 2.1, please enter the drive."
  40.   Say "Example) C:"
  41.   Parse Upper Pull tooldrive
  42.   toolpath=tooldrive||"\TOOLKT21"
  43.  
  44.   Say "OS/2 Toolkit 2.1 DRIVE =" tooldrive
  45.   Say "OS/2 toolkit 2.1 PATH =" toolpath
  46.   Say "Is OS/2 Toolkit 2.1 in drive" tooldrive"?(Y/N)"
  47.   Parse Upper Pull response
  48.   If response <> 'Y' Then Do
  49.      tooldrive = ''
  50.      Say "Re-enter the Drive that contains OS/2 Toolkit 2.1."
  51.      Parse Upper Pull tooldrive
  52.  
  53.      toolpath = tooldrive||'\TOOLKT21'
  54.   End
  55. End
  56. Else Do
  57.   Say "Path found for the OS/2 2.1 Toolkit."
  58.   toolpath = tooldrive||'\TOOLKT21'
  59.  
  60.   Say "OS/2 Toolkit 2.1 DRIVE =" tooldrive
  61.   Say "OS/2 toolkit 2.1 PATH =" toolpath
  62.   Say "Is OS/2 Toolkit 2.1 information correct?(Y/N)"
  63.   Parse Upper Pull response
  64.   If response <> 'Y' Then Do
  65.      tooldrive = ''
  66.      Say "Re-enter the Drive that contains Toolkit 2.1."
  67.      Parse Upper Pull tooldrive
  68.  
  69.      toolpath = tooldrive||'\TOOLKT21'
  70.   End
  71. End
  72.  
  73. Do Until file.0 <> 0
  74.    ret = SysFileTree(toolpath, 'file', 'D')
  75.  
  76.    If file.0 = 0 Then Do
  77.       'CLS'
  78.       Say "The OS/2 Toolkit 2.1 is not in drive" tooldrive"."
  79.       Say "Do you want to exit from OS/2 Toolkit installation?(Y/N)"
  80.       Parse Upper Pull response
  81.       If Substr(response,1,1) = 'Y' Then Call Endit
  82.  
  83.       tooldrive=''
  84.       Say "Please re-enter the drive for OS/2 Toolkit 2.1."
  85.       Say "Example) C:"
  86.       Parse Upper Pull tooldrive
  87.       toolpath=tooldrive||"\TOOLKT21"
  88.  
  89.       Say "OS/2 Toolkit 2.1 DRIVE =" tooldrive
  90.       Say "OS/2 Toolkit 2.1 PATH =" toolpath
  91.       Say "Is OS/2 Toolkit 2.1 in drive" tooldrive"?(Y/N)"
  92.       Parse Upper Pull response
  93.       If response <> 'Y' Then Do
  94.          tooldrive = ''
  95.          Say "Re-enter the Drive that contains OS/2 Toolkit 2.1."
  96.          Parse Upper Pull tooldrive
  97.          toolpath = tooldrive||'\TOOLKT21'
  98.       End  /* If */
  99.    End  /* If */
  100. End /* do */
  101.  
  102.  
  103. /*****************************************************************************/
  104. /*    Ask User for Toolkit drive if there is no toolkit info in system       */
  105. /*****************************************************************************/
  106.  
  107. 'CLS'
  108. Say "Your OS/2 system is installed on the" bootdrive "drive."
  109. Say " "
  110. Say "The OS/2 Toolkit 2.1 components have been found:"
  111. Say " "
  112. If tooldrive <> '' Then Say "     OS/2 Toolkit 2.1 is in" toolpath
  113. Say " "
  114. Say "This program will now create a folder for OS/2 Toolkit 2.1 and"
  115. Say "its identified components on your desktop."
  116. Say " "
  117. Say "Do you want to continue (Y/N)?"
  118. Parse Upper Pull yesno .
  119. If Substr(yesno,1,1) <> 'Y' Then Call Endit
  120.  
  121. /*****************************************************************************/
  122. /*        Define & Create the Toolkit Folder for the TOOLKIT 2.1                  */
  123. /*****************************************************************************/
  124.  
  125. If tooldrive <> '' Then Do
  126.   Call SysCreateObject 'WPFolder', 'Toolkit 2.1','<WP_DESKTOP>','OBJECTID=<TK_TOOLKIT>;ICONFILE='||toolpath||'\ICON\UTILS.ICO','R'
  127.  
  128. /*****************************************************************************/
  129. /* Create the Toolkit Info., Dev. Tool, & Sample Folder for the TOOLKIT 2.1  */
  130. /*****************************************************************************/
  131.  
  132.   Call SysCreateObject 'WPFolder', 'Toolkit Information','<TK_TOOLKIT>','OBJECTID=<TK_DEVINFO>;ICONFILE='||toolpath||'\ICON\ICONINFO.ICO','R'
  133.   Call SysCreateObject 'WPFolder', 'Development Tools','<TK_TOOLKIT>','OBJECTID=<TK_DEVTOOLS>;ICONFILE='||toolpath||'\ICON\FXICON.ICO','R'
  134.   Call SysCreateObject 'WPFolder', 'Sample Programs','<TK_TOOLKIT>','OBJECTID=<TK_CSAMPLE>;ICONFILE='||toolpath||'\ICON\OSTUTOR.ICO','R'
  135.   Call SysCreateObject 'WPShadow','Toolkit Readme','<TK_TOOLKIT>','OBJECTID=<TK_TKREADME>;ICONFILE='||toolpath||'\;SHADOWID='||toolpath||'\READ.ME','R'
  136.  
  137. /*****************************************************************************/
  138. /*        Create Reference Program ICONs in TOOLKIT Info Folder              */
  139. /*****************************************************************************/
  140.  
  141.   Call SysCreateObject 'WPProgram','REXX Reference','<TK_DEVINFO>','OBJECTID=<TK_REXXAPI>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=REXXAPI.INF;STARTUPDIR='||toolpath||'\BOOK;','R'
  142.   Call SysCreateObject 'WPProgram','IPF Reference','<TK_DEVINFO>','OBJECTID=<TK_IPFC20>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=IPFC20.INF;STARTUPDIR='||toolpath||'\BOOK;','R'
  143.   Call SysCreateObject 'WPProgram','SOM Reference','<TK_DEVINFO>','OBJECTID=<TK_SOMREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=SOM.INF;STARTUPDIR='||toolpath||'\BOOK;','R'
  144.   Call SysCreateObject 'WPProgram','Tools Reference','<TK_DEVINFO>','OBJECTID=<TK_TOOLREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=TOOLINFO.INF;STARTUPDIR='||toolpath||'\BOOK;','R'
  145.   Call SysCreateObject 'WPProgram','PM Reference','<TK_DEVINFO>','OBJECTID=<TK_PMREF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=PMREF;STARTUPDIR='||toolpath||'\BOOK;','R'
  146.   Call SysCreateObject 'WPProgram','CP Guide and Reference','<TK_DEVINFO>','OBJECTID=<TK_PROGREF21>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=PROGREF21;STARTUPDIR='||toolpath||'\BOOK;','R'
  147.   Call SysCreateObject 'WPProgram','Kernel Debug Reference','<TK_DEVINFO>','OBJECTID=<TK_KDEBUG>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=KDEBUG.INF;STARTUPDIR='||toolpath||'\BOOK;','R'
  148.   Call SysCreateObject 'WPProgram','KwikInf','<TK_DEVINFO>','OBJECTID=<TK_KWIKINF>;EXENAME='||toolpath||'\OS2BIN\KWIKINF.EXE;PROGTYPE=PM;STARTUPDIR='||toolpath||'\OS2BIN;','R'
  149.  
  150. /*****************************************************************************/
  151. /*        Create Sample Program  ICONs in Samples Folder                     */
  152. /*****************************************************************************/
  153.   samples.1  = toolpath||'\C\SAMPLES\WORMS\WORMS.EXE WINDOWABLEVIO; -30;  Mixed Mode Sample ; <TK_WORMS>'
  154.   samples.2  = toolpath||'\C\SAMPLES\ANIMALS\ANIMALS.CMD WINDOWABLEVIO ;; SOM Inheritance Sample ; <TK_ANIMALS>'
  155.   samples.3  = toolpath||'\C\SAMPLES\TP\TP.CMD WINDOWABLEVIO ;; SOM Text Processing Sample ; <TK_TP>'
  156.   samples.4  = toolpath||'\C\SAMPLES\NPIPE\SVRNPIPE.EXE PM ;CLINPIPE.EXE; Tic-Tac-Toe Sample ; <TK_NPIPE>'
  157.   samples.5  = toolpath||'\C\SAMPLES\DLLAPI\DLLAPI.EXE PM ;;Dynamic Link Library Sample ; <TK_DLLAPI>'
  158.   samples.6  = toolpath||'\C\SAMPLES\QUEUES\SVRQUEUE.EXE PM ;CLIQUEUE.EXE;Queues Sample ; <TK_QUEUES>'
  159.   samples.7  = toolpath||'\C\SAMPLES\CLOCK\CLOCK.EXE PM ;;Clock Sample ; <TK_TKCLOCK>'
  160.   samples.8  = toolpath||'\C\SAMPLES\DRAGDROP\DRAGDROP.EXE PM ;;Dragdrop Sample ; <TK_DRAGDROP>'
  161.   samples.9  = toolpath||'\C\SAMPLES\STYLE\STYLE.EXE PM ;;Style Sample ; <TK_STYLE>'
  162.   samples.10 = toolpath||'\C\SAMPLES\SEMAPH\SEMAPH.EXE PM ;;Semaphore Sample ; <TK_SEMAPH>'
  163.   samples.11 = toolpath||'\C\SAMPLES\IMAGE\IMAGE32.EXE PM ;; Image Sample ; <TK_IMAGE>'
  164.   samples.12 = toolpath||'\C\SAMPLES\VMM\VMM.EXE PM ;; Virtual Memory Management Sample ; <TK_VMM>'
  165.   samples.13 = toolpath||'\C\SAMPLES\TEMPLATE\TEMPLATE.EXE PM ;;Application Template Sample ; <TK_TEMPLATE>'
  166.   samples.14 = toolpath||'\C\SAMPLES\HANOI\HANOI.EXE PM ;; Towers of Hanoi Sample ; <TK_HANOI>'
  167.   samples.15 = toolpath||'\C\SAMPLES\JIGSAW\JIGSAW.EXE PM ;; Jigsaw Puzzle Sample ; <TK_TKJIGSAW>'
  168.   samples.16 = toolpath||'\C\SAMPLES\EAS\EAS.EXE PM ;; Edit Extended Attributes Sample ; <TK_EAS>'
  169.   samples.17 = toolpath||'\C\SAMPLES\SORT\SORT.EXE PM ;; Sorting Algorithm Sample ; <TK_SORT>'
  170.   samples.18 = toolpath||'\C\SAMPLES\HELLO\HELLO.EXE PM ;; Standard Window Sample ; <TK_HELLO>'
  171.   samples.19 = toolpath||'\C\SAMPLES\GRAPHIC\GRAPHIC.EXE PM ;; Retained Graphics Sample ; <TK_GRAPHIC>'
  172.   samples.20 = toolpath||'\C\SAMPLES\DIALOG\DIALOG.EXE PM ;; Introductory Dialog Box Sample ; <TK_DIALOG>'
  173.   samples.21 = toolpath||'\C\SAMPLES\CLIPBRD\CLIPBRD.EXE PM ;; Clipboard Sample ; <TK_CLIPBRD>'
  174.   samples.22 = toolpath||'\C\SAMPLES\PRINT\PRTSAMP.EXE PM ;; Print Sample ; <TK_PRINT>'
  175.   samples.23 = toolpath||'\REXX\SAMPLES\CALLREXX\CALLREXX.EXE WINDOWABLEVIO ;; REXX Interpreter Invocation Sample ; <TK_CALLREXX>'
  176.   samples.24 = toolpath||'\REXX\SAMPLES\DEVINFO\DEVINFO.CMD WINDOWABLEVIO ;; REXX Variable Pool Interface Sample ; <TK_RXTKINFO>'
  177.   samples.25 = toolpath||'\REXX\SAMPLES\PMREXX\PMREXX.EXE WINDOWABLEVIO ; REXXTRY.CMD; Presentation Manager REXX Interface Sample ; <TK_PMREXX>'
  178.   samples.26 = toolpath||'\REXX\SAMPLES\REXXUTIL\REXXUDEM.CMD WINDOWABLEVIO ;; REXX Utility Functions Sample ; <TK_REXXUTIL>'
  179.   samples.27 = toolpath||'\REXX\SAMPLES\RXMACDLL\RXMACDLL.CMD WINDOWABLEVIO ;; External Functions in REXX Macrospace Sample ; <TK_RXMACDLL>'
  180.   samples.0  = 27
  181.  
  182.   Do i = 1 to samples.0
  183.     Parse Var samples.i program type ';' parms ';' title ';' objid
  184.     program = Strip(program)
  185.     type = Strip(title)
  186.     parms = Strip(parms)
  187.     title = Strip(title)
  188.     objid = Strip(objid)
  189.  
  190.     If parms = '' Then Do
  191.       Call SysCreateObject 'WPProgram',title,'<TK_CSAMPLE>','OBJECTID='||objid||';EXENAME='||program||';PROGTYPE='||type||';STARTUPDIR='||Filespec('D',program)||Substr(Filespec('P',program),1,Length(Filespec('P',program))-1)||';','R'
  192.     End
  193.     Else Do
  194. Call SysCreateObject 'WPProgram',title,'<TK_CSAMPLE>','OBJECTID='||objid||';EXENAME='||program||';PROGTYPE='||type||';PARAMETERS='||parms||';STARTUPDIR='||Filespec('D',program)||Substr(Filespec('P',program),1,Length(Filespec('P',program))-1)||';','R'
  195.      End
  196.   End
  197.  
  198.  
  199.   Call SysCreateObject 'WPProgram','Palette Sample','<TK_CSAMPLE>','OBJECTID=<TK_PALETTE>;EXENAME='||toolpath||'\C\SAMPLES\PALETTE\PALETTE.EXE;PROGTYPE=PM;STARTUPDIR='||toolpath||'\C\SAMPLES\PALETTE;','R'
  200.  
  201.   Call SysCreateObject 'WPProgram','Information Presentation Facility Sample','<TK_CSAMPLE>','OBJECTID=<TK_IPF>;EXENAME='||bootdrive||'\OS2\VIEW.EXE;PROGTYPE=PM;PARAMETERS=IPF.INF;STARTUPDIR='||toolpath||'\C\SAMPLES\IPF;','R'
  202.  
  203.  
  204.   Call SysRegisterObjectClass 'Car', toolpath||'\C\SAMPLES\WPCAR\CAR.DLL'
  205.   Call SysCreateObject 'Car', 'WP Car Sample','<TK_CSAMPLE>','OBJECTID=<TK_CAR>'
  206.  
  207. /*****************************************************************************/
  208. /*        Create Utility ICONs                                               */
  209. /*****************************************************************************/
  210.  
  211.   Call SysCreateObject 'WPProgram','Dialog Editor','<TK_DEVTOOLS>','OBJECTID=<TK_DLGEDIT>;EXENAME='||toolpath||'\OS2BIN\DLGEDIT.EXE;PROGTYPE=PM;STARTUPDIR='||bootdrive||'\;','R'
  212.   Call SysCreateObject 'WPProgram','Font Editor','<TK_DEVTOOLS>','OBJECTID=<TK_FONTEDIT>;EXENAME='||toolpath||'\OS2BIN\FONTEDIT.EXE;PROGTYPE=PM;STARTUPDIR='||bootdrive||'\;','R'
  213.   Call SysCreateObject 'WPProgram','Icon Editor','<TK_DEVTOOLS>','OBJECTID=<TK_ICONEDIT>;EXENAME='||toolpath||'\OS2BIN\ICONEDIT.EXE;PROGTYPE=PM;STARTUPDIR='||bootdrive||'\;','R'
  214.  
  215.   Call SysRegisterObjectClass 'WPKlist', toolpath||'\DLL\WPCLSLST.DLL'
  216.   Call SysCreateObject 'WPKlist', 'WP Class List','<TK_DEVTOOLS>','OBJECTID=<TK_CLIST>'
  217.  
  218. /*****************************************************************************/
  219. /*        Update the CONFIG.SYS                                              */
  220. /*****************************************************************************/
  221.   Call Tk21ChgConfig
  222.  
  223. End
  224.  
  225.  
  226. /****************/
  227. /* Exit program */
  228. /****************/
  229. Endit:
  230. Exit 0
  231.  
  232. /***************************/
  233. /* Change the CONFIG.SYS   */
  234. /***************************/
  235.  
  236. Tk21ChgConfig:   /* change the config.sys file for Toolkit 2.1 */
  237.  
  238. '@cls'
  239. response=''
  240.  
  241. Say '    Do you want to update 'bootdrive'\CONFIG.SYS?(Y/N)'
  242.   Parse Upper Pull response
  243.   If response <> 'N' Then Do
  244.      Say '    The old 'bootdrive'\CONFIG.SYS will be created called 'bootdrive'\CONFIG.TKT.'
  245.      Say ' '
  246.      Say '    Shutdown and restart your system for these changes to take affect.'
  247.      Say ' '
  248.   End
  249.   Else
  250.      return 0
  251.  
  252.  
  253. oldconfig=bootdrive'\CONFIG.SYS'
  254. newconfig=bootdrive'\CONFIG.TKT'
  255. tmpconfig=bootdrive'\TMP.SYS'
  256.  
  257. os2path='SET PATH'
  258. os2libpath='LIBPATH'
  259. os2help='SET HELP'
  260. os2bookshelf='SET BOOKSHELF'
  261. os2ipfc='SET IPFC'
  262. os2include='SET INCLUDE'
  263. os2lib='SET LIB'
  264. os2progref21='SET PROGREF21'
  265. os2helpndx='SET HELPNDX'
  266. os2pmref='SET PMREF'
  267.  
  268. ipfcflag=0
  269. includeflag=0
  270. libflag=0
  271. progref21flag=0
  272. helpndxflag=0
  273. pmrefflag=0
  274.  
  275. /* get the portion of pathspec without the [drive]: */
  276. pathonly = right(toolpath, length(toolpath)-2)
  277.  
  278. /*
  279.  * read the file one line at a time, and write it all out, making
  280.  * changes accordingly - need to change path, libpath, help, bookshelf
  281.  * ipfc, include, lib
  282.  */
  283.  
  284. '@del 'newconfig ' 2>nul >nul'
  285.  
  286. Do while lines(oldconfig)
  287.     inline=linein(oldconfig)
  288.  
  289.     /******************************************/
  290.     /* parse the line into variable and value */
  291.     /******************************************/
  292.  
  293.     parse value inline with os2var '=' os2value
  294.  
  295.     /********************************************************/
  296.     /* translate the variable into uppercase for comparison */
  297.     /********************************************************/
  298.  
  299.     os2var=translate(os2var)
  300.     Select
  301.  
  302.         /********************************************************/
  303.         /*          For PATH                                    */
  304.         /********************************************************/
  305.         when os2var=os2path Then Do
  306.             tk21line=inline
  307.  
  308.             /* see if path is already set */
  309.             k = pos(pathonly'\OS2BIN', translate(tk21line))
  310.             If k = 0 Then Do
  311.                /* See if Toolkit 2.0 exist */
  312.                t = pos('\TOOLKT20\OS2BIN', translate(os2value))
  313.  
  314.                If t <> 0 Then Do
  315.                   l=length(toolpath'\OS2BIN;')
  316.                   tk21line=os2var'='Insert(toolpath'\OS2BIN;', os2value, t-3, l)
  317.                End
  318.                Else Do
  319.                   /*
  320.                    * see if there is a ; at the end of the value
  321.                    */
  322.                   position=lastpos(';',os2value)
  323.                   lenvalue=length(os2value)
  324.  
  325.                   If position=lenvalue Then do
  326.                       /* ; at end of value */
  327.                       tk21line=os2var'='os2value''toolpath'\OS2BIN;'
  328.                   End
  329.                   Else Do
  330.                       /* ; NOT at end of value */
  331.                       tk21line=os2var'='os2value';'toolpath'\OS2BIN;'
  332.                   End
  333.                End
  334.             End
  335.             Else  /* see if the drive letter is not the same */
  336.               If substr(tk21line, k-2, 1) \= tooldrive Then
  337.                 /* change the drive letter only */
  338.                 tk21line = overlay(tooldrive, tk21line, k-2)
  339.  
  340.             /*
  341.              * write the line out to the new config file
  342.              */
  343.  
  344.             result=lineout(newconfig, tk21line)
  345.  
  346.             If result=1 Then Do
  347.                 writeerror()
  348.                 return 1
  349.             End
  350.         End
  351.  
  352.         /********************************************************/
  353.         /*          For LIBPATH                                 */
  354.         /********************************************************/
  355.         when os2var=os2libpath Then Do
  356.             tk21line=inline
  357.  
  358.             /* see if lib path is already set */
  359.             k = pos(pathonly'\DLL', translate(tk21line))
  360.             If k = 0 Then Do
  361.                /* See if Toolkit 2.0 exist */
  362.                t = pos('\TOOLKT20\DLL', translate(os2value))
  363.  
  364.                If t <> 0 Then Do
  365.                   l=length(toolpath'\DLL;')
  366.                   tk21line=os2var'='Insert(toolpath'\DLL;', os2value, t-3, l)
  367.                End
  368.                Else Do
  369.                   /*
  370.                    * see if there is a ; at the end of the value
  371.                    */
  372.  
  373.                   position=lastpos(';',os2value)
  374.                   lenvalue=length(os2value)
  375.  
  376.                   If position=lenvalue Then Do
  377.                       /* ; at end of value */
  378.                       tk21line=os2var'='os2value''toolpath'\DLL;'
  379.                   End
  380.                   Else Do
  381.                       /* ; NOT at end of value */
  382.                       tk21line=os2var'='os2value';'toolpath'\DLL;'
  383.                   End
  384.                End
  385.             End
  386.             Else  /* see if the drive letter is not the same */
  387.               If substr(tk21line, k-2, 1) \= tooldrive Then
  388.                 /* change the drive letter only */
  389.                 tk21line = overlay(tooldrive, tk21line, k-2)
  390.  
  391.             /*
  392.              * write the line out to the new config file
  393.              */
  394.  
  395.             result=lineout(newconfig, tk21line)
  396.             If result=1 Then Do
  397.                 writeerror()
  398.                 return 1
  399.             End
  400.         End
  401.  
  402.         /********************************************************/
  403.         /*          For SET HELP                                */
  404.         /********************************************************/
  405.         when os2var=os2help Then Do
  406.             tk21line=inline
  407.  
  408.             /* see if lib path is already set */
  409.             k = pos(pathonly'\OS2HELP', translate(tk21line))
  410.             If k = 0 Then Do
  411.                /* See if Toolkit 2.0 exist */
  412.                t = pos('\TOOLKT20\OS2HELP', translate(os2value))
  413.  
  414.                If t <> 0 Then Do
  415.                   l=length(toolpath'\OS2HELP;')
  416.                   tk21line=os2var'='Insert(toolpath'\OS2HELP;', os2value, t-3, l)
  417.                End
  418.                Else Do
  419.                   /*
  420.                    * see if there is a ; at the end of the value
  421.                    */
  422.  
  423.                   position=lastpos(';',os2value)
  424.                   lenvalue=length(os2value)
  425.  
  426.                   If position=lenvalue Then Do
  427.                       /* ; at end of value */
  428.                       tk21line=os2var'='os2value''toolpath'\OS2HELP;'
  429.                   End
  430.                   Else Do
  431.                       /* ; NOT at end of value */
  432.                       tk21line=os2var'='os2value';'toolpath'\OS2HELP;'
  433.                   End
  434.                End
  435.             End
  436.             Else  /* see if the drive letter is not the same */
  437.               If substr(tk21line, k-2, 1) \= tooldrive Then
  438.                 /* change the drive letter only */
  439.                 tk21line = overlay(tooldrive, tk21line, k-2)
  440.  
  441.             /*
  442.              * write the line out to the new config file
  443.              */
  444.  
  445.             result=lineout(newconfig, tk21line)
  446.             If result=1 Then Do
  447.                 writeerror()
  448.                 return 1
  449.             End
  450.         End
  451.  
  452.         /********************************************************/
  453.         /*          For SET BOOKSELF                            */
  454.         /********************************************************/
  455.         when os2var=os2bookshelf Then Do
  456.             tk21line=inline
  457.  
  458.             /* see if lib path is already set */
  459.             k = pos(pathonly'\BOOK', translate(tk21line))
  460.             If k = 0 Then Do
  461.                /* See if Toolkit 2.0 exist */
  462.                t = pos('\TOOLKT20\BOOK', translate(os2value))
  463.  
  464.                If t <> 0 Then Do
  465.                   l=length(toolpath'\BOOK;')
  466.                   tk21line=os2var'='Insert(toolpath'\BOOK;', os2value, t-3, l)
  467.                End
  468.                Else Do
  469.                   /*
  470.                    * see if there is a ; at the end of the value
  471.                    */
  472.  
  473.                   position=lastpos(';',os2value)
  474.                   lenvalue=length(os2value)
  475.  
  476.                   If position=lenvalue Then Do
  477.                       /* ; at end of value */
  478.                       tk21line=os2var'='os2value''toolpath'\BOOK;'
  479.                   End
  480.                   Else Do
  481.                       /* ; NOT at end of value */
  482.                       tk21line=os2var'='os2value';'toolpath'\BOOK;'
  483.                   End
  484.                End
  485.             End
  486.             Else  /* see if the drive letter is not the same */
  487.               If substr(tk21line, k-2, 1) \= tooldrive Then
  488.                 /* change the drive letter only */
  489.                 tk21line = overlay(tooldrive, tk21line, k-2)
  490.  
  491.             /*
  492.              * write the line out to the new config file
  493.              */
  494.  
  495.             result=lineout(newconfig, tk21line)
  496.             If result=1 Then Do
  497.                 writeerror()
  498.                 return 1
  499.             End
  500.         End
  501.  
  502.         /********************************************************/
  503.         /*          For SET IPFC                                */
  504.         /********************************************************/
  505.         when os2var=os2ipfc Then Do
  506.  
  507.             ipfcflag=1
  508.             tk21line=inline
  509.  
  510.             k = pos(pathonly'\IPFC', translate(tk21line))
  511.             If k = 0 Then Do
  512.                /* See if Toolkit 2.0 exist */
  513.                t = pos('\TOOLKT20\IPFC', translate(os2value))
  514.  
  515.                If t <> 0 Then Do
  516.                   l=length(toolpath'\IPFC;')
  517.                   tk21line=os2var'='Insert(toolpath'\IPFC;', os2value, t-3, l)
  518.                End
  519.                Else Do
  520.                   /*
  521.                    * see if there is a ; at the end of the value
  522.                    */
  523.  
  524.                   position=lastpos(';',os2value)
  525.                   lenvalue=length(os2value)
  526.  
  527.                   If position=lenvalue Then Do
  528.                       /* ; at end of value */
  529.                       tk21line=os2var'='os2value''toolpath'\IPFC'
  530.                   End
  531.                   Else Do
  532.                       /* ; NOT at end of value */
  533.                       tk21line=os2var'='os2value';'toolpath'\IPFC'
  534.                   End
  535.                End
  536.             End
  537.             Else  /* see if the drive letter is not the same */
  538.               If substr(tk21line, k-2, 1) \= tooldrive Then
  539.                 /* change the drive letter only */
  540.                 tk21line = overlay(tooldrive, tk21line, k-2)
  541.  
  542.             /*
  543.              * write the line out to the new config file
  544.              */
  545.  
  546.             result=lineout(newconfig, tk21line)
  547.             If result=1 Then Do
  548.                 writeerror()
  549.                 return 1
  550.             End
  551.         End
  552.  
  553.         /********************************************************/
  554.         /*          For SET INCLUDE                             */
  555.         /********************************************************/
  556.         when os2var=os2include Then Do
  557.  
  558.             includeflag=1
  559.             tk21line=inline
  560.  
  561.             /* see if C\OS2H path is already set */
  562.             k = pos(pathonly'\C\OS2H', translate(tk21line))
  563.  
  564.             If k = 0 Then Do
  565.                /* See if Toolkit 2.0 exist */
  566.                t = pos('\TOOLKT20\C\OS2H', translate(os2value))
  567.  
  568.                If t <> 0 Then Do
  569.                   l=length(toolpath'\C\OS2H;')
  570.                   tk21line=os2var'='Insert(toolpath'\C\OS2H;', os2value, t-3, l)
  571.                End
  572.                Else Do
  573.                   /*
  574.                    * see if there is a ; at the end of the value
  575.                    */
  576.  
  577.                   position=lastpos(';',os2value)
  578.                   lenvalue=length(os2value)
  579.  
  580.                   If position=lenvalue Then Do
  581.                       /* ; at end of value */
  582.                       tk21line=os2var'='os2value''toolpath'\C\OS2H;'
  583.                   End
  584.                   Else Do
  585.                       /* ; NOT at end of value */
  586.                       tk21line=os2var'='os2value';'toolpath'\C\OS2H;'
  587.                   End
  588.                End
  589.             End
  590.             Else  /* see if the drive letter is not the same */
  591.               If substr(tk21line, k-2, 1) \= tooldrive Then
  592.                 /* change the drive letter only */
  593.                 tk21line = overlay(tooldrive, tk21line, k-2)
  594.  
  595.             /* see if ASM\OS2INC path is already set */
  596.             k = pos(pathonly'\ASM\OS2INC', translate(tk21line))
  597.             If k = 0 Then Do
  598.                /* See if Toolkit 2.0 exist */
  599.                t = pos('\TOOLKT20\ASM\OS2INC', translate(tk21line))
  600.  
  601.                If t <> 0 Then Do
  602.                   l=length(toolpath'\ASM\OS2INC;')
  603.                   tk21line=Insert(toolpath'\ASM\OS2INC;', tk21line, t-3, l)
  604.                End
  605.                Else Do
  606.                   /*
  607.                    * see if there is a ; at the end of the value
  608.                    */
  609.  
  610.                   position=lastpos(';',tk21line)
  611.                   lenvalue=length(tk21line)
  612.  
  613.                   If position=lenvalue Then Do
  614.                       /* ; at end of value */
  615.                       tk21line=tk21line||toolpath'\ASM\OS2INC;'
  616.                   End
  617.                   Else Do
  618.                       /* ; NOT at end of value */
  619.                       tk21line=tk21line';'toolpath'\ASM\OS2INC;'
  620.                   End
  621.                End
  622.             End
  623.             Else  /* see if the drive letter is not the same */
  624.               If substr(tk21line, k-2, 1) \= tooldrive Then
  625.                 /* change the drive letter only */
  626.                 tk21line = overlay(tooldrive, tk21line, k-2)
  627.  
  628.             /* see if C\OS2H\VDD path is already set */
  629.             k = pos(pathonly'\C\OS2H\VDD', translate(tk21line))
  630.             If k = 0 Then Do
  631.                /* See if Toolkit 2.0 exist */
  632.                t = pos('\TOOLKT20\C\OS2H\VDD', translate(tk21line))
  633.  
  634.                If t <> 0 Then Do
  635.                   l=length(toolpath'\C\OS2H\VDD;')
  636.                   tk21line=Insert(toolpath'\C\OS2H\VDD;', tk21line, t-3, l)
  637.                End
  638.                Else Do
  639.                   /*
  640.                    * see if there is a ; at the end of the value
  641.                    */
  642.  
  643.                   position=lastpos(';',tk21line)
  644.                   lenvalue=length(tk21line)
  645.  
  646.                   If position=lenvalue Then Do
  647.                       /* ; at end of value */
  648.                       tk21line=tk21line''toolpath'\C\OS2H\VDD;'
  649.                   End
  650.                   Else Do
  651.                       /* ; NOT at end of value */
  652.                       tk21line=tk21line';'toolpath'\C\OS2H\VDD;'
  653.                   End
  654.                End
  655.             End
  656.             Else  /* see if the drive letter is not the same */
  657.               If substr(tk21line, k-2, 1) \= tooldrive Then
  658.                 /* change the drive letter only */
  659.                 tk21line = overlay(tooldrive, tk21line, k-2)
  660.             /*
  661.              * write the line out to the new config file
  662.              */
  663.  
  664.             result=lineout(newconfig, tk21line)
  665.             If result=1 Then Do
  666.                 writeerror()
  667.                 return 1
  668.             End
  669.         End
  670.  
  671.         /********************************************************/
  672.         /*          For SET LIB                                 */
  673.         /********************************************************/
  674.  
  675.         when os2var=os2lib Then Do
  676.             libflag=1
  677.  
  678.             tk21line=inline
  679.  
  680.             /* see if lib path is already set */
  681.             k = pos(pathonly'\OS2LIB', translate(tk21line))
  682.             If k = 0 Then Do
  683.                /* See if Toolkit 2.0 exist */
  684.                t = pos('\TOOLKT20\OS2LIB', translate(os2value))
  685.  
  686.                If t <> 0 Then Do
  687.                   l=length(toolpath'\OS2LIB;')
  688.                   tk21line=os2var'='Insert(toolpath'\OS2LIB;', os2value, t-3, l)
  689.                End
  690.                Else Do
  691.                   /*
  692.                    * see if there is a ; at the end of the value
  693.                    */
  694.  
  695.                   position=lastpos(';',os2value)
  696.                   lenvalue=length(os2value)
  697.  
  698.                   If position=lenvalue Then Do
  699.                       /* ; at end of value */
  700.                       tk21line=os2var'='os2value''toolpath'\OS2LIB;'
  701.                   End
  702.                   Else Do
  703.                       /* ; NOT at end of value */
  704.                       tk21line=os2var'='os2value';'toolpath'\OS2LIB;'
  705.                   End
  706.                End
  707.             End
  708.             Else  /* see if the drive letter is not the same */
  709.               If substr(tk21line, k-2, 1) \= tooldrive Then
  710.                 /* change the drive letter only */
  711.                 tk21line = overlay(tooldrive, tk21line, k-2)
  712.  
  713.             /*
  714.              * write the line out to the new config file
  715.              */
  716.  
  717.             result=lineout(newconfig, tk21line)
  718.             If result=1 Then Do
  719.                 writeerror()
  720.                 return 1
  721.             End
  722.         End
  723.  
  724.         /********************************************************/
  725.         /*          For PROGREF21                               */
  726.         /********************************************************/
  727.  
  728.         when os2var=os2progref21 Then Do
  729.             progref21flag=1
  730.  
  731.             tk21line=inline
  732.  
  733.             /*
  734.              * write the line out to the new config file
  735.              */
  736.  
  737.             result=lineout(newconfig, tk21line)
  738.             If result=1 Then Do
  739.                 writeerror()
  740.                 return 1
  741.             End
  742.  
  743.         End
  744.  
  745.         /********************************************************/
  746.         /*          For HELPNDX                                 */
  747.         /********************************************************/
  748.  
  749.         when os2var=os2helpndx Then Do
  750.             helpndxflag=1
  751.  
  752.             tk21line=inline
  753.  
  754.             /*
  755.              * write the line out to the new config file
  756.              */
  757.  
  758.             result=lineout(newconfig, tk21line)
  759.             If result=1 Then Do
  760.                 writeerror()
  761.                 return 1
  762.             End
  763.  
  764.         End
  765.  
  766.         /********************************************************/
  767.         /*          For PMREF                                   */
  768.         /********************************************************/
  769.  
  770.         when os2var=os2pmref Then Do
  771.             pmrefflag=1
  772.  
  773.             tk21line=inline
  774.  
  775.             /*
  776.              * write the line out to the new config file
  777.              */
  778.  
  779.             result=lineout(newconfig, tk21line)
  780.             If result=1 Then Do
  781.                 writeerror()
  782.                 return 1
  783.             End
  784.  
  785.         End
  786.  
  787.         otherwise Do
  788.             /*
  789.              * write the line out to the new config file
  790.              */
  791.  
  792.             result=lineout(newconfig, inline)
  793.             If result=1 Then Do
  794.                 writeerror()
  795.                 return 1
  796.             End
  797.         End
  798.  
  799.     End  /* select */
  800.  
  801. End /* Do */
  802.  
  803. /***************************************************************/
  804. /* if there was no SET IPFC variable set in CONFIG.SYS, Then   */
  805. /* put New env. variables                                      */
  806. /***************************************************************/
  807.  
  808. If ipfcflag=0 Then Do
  809.  
  810.     tk21line='SET IPFC='toolpath'\IPFC'
  811.     /*
  812.      * write the line out to the new config file
  813.      */
  814.  
  815.     result=lineout(newconfig, tk21line)
  816.     If result=1 Then Do
  817.         writeerror()
  818.         return 1
  819.     End
  820. End
  821.  
  822. /******************************************************************/
  823. /* if there was no SET INCLUDE variable set in CONFIG.SYS, Then   */
  824. /* put New env. variables                                         */
  825. /******************************************************************/
  826.  
  827. If includeflag=0 Then Do
  828.  
  829.     tk21line='SET INCLUDE='toolpath'\C\OS2H;'toolpath'\C\OS2H\VDD;'toolpath'\ASM\OS2INC;'
  830.  
  831.     /*
  832.      * write the line out to the new config file
  833.      */
  834.  
  835.     result=lineout(newconfig, tk21line)
  836.     If result=1 Then Do
  837.         writeerror()
  838.         return 1
  839.     End
  840. End
  841.  
  842. /******************************************************************/
  843. /* if there was no SET LIB variable set in CONFIG.SYS, Then       */
  844. /* put New env. variables                                         */
  845. /******************************************************************/
  846.  
  847. If libflag=0 Then Do
  848.  
  849.     tk21line='SET LIB='toolpath'\OS2LIB;'
  850.  
  851.     /*
  852.      * write the line out to the new config file
  853.      */
  854.  
  855.     result=lineout(newconfig, tk21line)
  856.     If result=1 Then Do
  857.         writeerror()
  858.         return 1
  859.     End
  860. End
  861.  
  862. /******************************************************************/
  863. /* if there was no SET PROGREF21 variable set in CONFIG.SYS, Then */
  864. /* put New env. variables                                         */
  865. /******************************************************************/
  866.  
  867. If progref21flag=0 Then Do
  868.  
  869.     tk21line='SET PROGREF21=CPGREF1.INF+CPGREF2.INF+CPGREF3.INF'
  870.  
  871.     /*
  872.      * write the line out to the new config file
  873.      */
  874.  
  875.     result=lineout(newconfig, tk21line)
  876.     If result=1 Then Do
  877.         writeerror()
  878.         return 1
  879.     End
  880. End
  881.  
  882. /******************************************************************/
  883. /* if there was no SET HELPNDX variable set in CONFIG.SYS, Then   */
  884. /* put New env. variables                                         */
  885. /******************************************************************/
  886.  
  887. If helpndxflag=0 Then Do
  888.  
  889.     tk21line='SET HELPNDX=EPMKWHLP.NDX'
  890.  
  891.     /*
  892.      * write the line out to the new config file
  893.      */
  894.  
  895.     result=lineout(newconfig, tk21line)
  896.     If result=1 Then Do
  897.         writeerror()
  898.         return 1
  899.     End
  900. End
  901.  
  902. /******************************************************************/
  903. /* if there was no SET PMREF variable set in CONFIG.SYS, Then     */
  904. /* put New env. variables                                         */
  905. /******************************************************************/
  906.  
  907. If pmrefflag=0 Then Do
  908.     tk21line='SET PMREF=PMFUN.INF+PMGPI.INF+PMHOK.INF+PMMSG.INF+PMREL.INF+PMWIN.INF+PMWKP.INF'
  909.  
  910.     /*
  911.      * write the line out to the new config file
  912.      */
  913.  
  914.     result=lineout(newconfig, tk21line)
  915.     If result=1 Then Do
  916.         writeerror()
  917.         return 1
  918.     End
  919. End
  920.  
  921. /*********************/
  922. /* close the files   */
  923. /*********************/
  924.  
  925. result=lineout(newconfig)
  926. result=lineout(oldconfig)
  927.  
  928. /******************************************************************/
  929. /* Copy created file(CONFIG.TKT) to temporary file(TMP.SYS),      */
  930. /* copy original file(CONFIG.SYS) to new file(CONFIG.TKT),        */
  931. /* and copy temporary file(TMP.SYS) to original file(CONFIG.SYS). */
  932. /******************************************************************/
  933.  
  934. '@copy 'oldconfig' 'tmpconfig' 2>nul >nul'
  935.  
  936. '@copy 'newconfig' 'oldconfig' 2>nul >nul'
  937.  
  938. '@copy 'tmpconfig' 'newconfig' 2>nul >nul'
  939.  
  940. '@del 'tmpconfig' 2>nul >nul'
  941. /******************************************************************/
  942. /*  Finished the Update                                           */
  943. /******************************************************************/
  944.  
  945. Say ' '
  946. Say '               'bootdrive'\CONFIG.SYS updated succesfully.'
  947. Say ' '
  948.  
  949. return 0
  950.  
  951.  
  952. writeerror:         /* display a write error to the screen */
  953.  
  954. '@cls'
  955. Say ' '
  956. Say ' '
  957. Say '                       *****  ERROR  *****'
  958. Say ' '
  959. Say '               An error occured while attempting to write the '
  960. Say '               'bootdrive'\CONFIG.SYS file.  Check the available disk'
  961. Say '               disk space on the current drive and retry the'
  962. Say '               install process.'
  963. Say ' '
  964.  
  965. return 0
  966.  
  967. /********************************/
  968. /* Notify user in case of error */
  969. /********************************/
  970. Telluser: Procedure
  971. Parse source . . tell_name .
  972. tell_name = Filespec('name',tell_name)
  973. Parse Upper Var tell_name tell_name '.' .
  974. ulogfile = tell_name
  975. If Arg(2,'e') = 0 Then Do
  976.   Say tell_name||':' Date('U') Time() Arg(1)
  977. End
  978. Else Do
  979.   If Arg(2) = 0 Then Do
  980.     Say tell_name||':' Date('U') Time() Arg(1)
  981.   End
  982.   Else Do
  983.     Say Copies(' ',15+Length(tell_name)) Arg(1)
  984.   End
  985. End
  986. Return 0
  987.