/* File INSTALL.CMD (CKOINS.CMD) Last update: Sat Jul 17 11:17:52 1993 A Rexx Program to install OS/2 C-Kermit 5A(189). Written by Jeffrey Altman, Altmania Productions, and Frank da Cruz, Columbia University, June 1993. All rights assigned to Columbia University. Copyright (C) 1985, 1993, Trustees of Columbia University in the City of New York. The C-Kermit software may not be, in whole or in part, licensed or sold for profit as a software product itself, nor may it be included in or distributed with commercial products or otherwise distributed by commercial concerns to their clients or customers without written permission of the Office of Kermit Development and Distribution, Columbia University. This copyright notice must not be removed, altered, or obscured. */ /* All the files to be installed must be in the same directory as INSTALL.CMD. This script: . Installs either the 16-bit or 32-bit version of C-Kermit depending on the version of OS/2 being used, and which one(s) is/are on the install disk. . Creates a directory for C-Kermit if necessary. . Creates a C-Kermit program object on the OS/2 2.x Desktop. . Customizes the CKERMOD.INI file according to the user's preferences. . Installs the dummy TCP/IP DLL, CKOTCP.DLL, only if needed. . Update the CONFIG.SYS file only at the user's request. */ /* Load RexxUtil if available */ RexxUtils = 1 SIGNAL ON SYNTAX NAME NoRexxUtil CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' CALL SysLoadFuncs SAY "RexxUtils installed. :-)" CALL ENDSIGNAL NOREXXUTIL: SAY "RexxUtils not installed. :-(" CALL RxFuncDrop 'SysLoadFuncs' RexxUtils = 0 ENDSIGNAL: SIGNAL OFF SYNTAX /* Determine OS/2 Version */ IF RexxUtils THEN OS2Ver = SysOS2Ver() ELSE OS2Ver = 1.x /* We assume this because RexxUtils is missing and Rexx is installed */ /* I have no other way of determining what the version is without */ /* SysOS2Ver() */ /* Determining Boot information */ IF RexxUtils THEN bootpath = SysSearchPath( 'DPATH', 'COUNTRY.SYS' ) ELSE bootpath = MySearchPath( 'DPATH', 'COUNTRY.SYS' ) bootdrive = FILESPEC( "drive", bootpath ) /* Save Current Directory and change to Source Directory */ startdir = DIRECTORY() PARSE SOURCE system calltype command drive = FILESPEC( "DRIVE", command ) path = FILESPEC( "PATH", command ) IF SUBSTR( path, LENGTH(path), 1 ) = '\' THEN sourcedir = DIRECTORY( drive || SUBSTR( path, 1, LENGTH(path)-1 ) ) ELSE sourcedir = DIRECTORY( drive || path ) /* SpaceRequired is the amount of free space required to install C-Kermit */ IF RexxUtils THEN DO spacerequired = 0 rc = SysFileTree( '*.*', 'file', 'F' ) DO i = 1 to file.0 PARSE VAR file.i date time size atts name spacerequired = spacerequired + 1024 + size END END ELSE spacerequired = 720000 /* Clear screen and prompt user for drive and path */ '@echo off' IF RexxUtils THEN CALL SysCls ELSE "CLS" SAY "*********************************************************" SAY "* Welcome to the OS/2 C-Kermit Installation Procedure. *" SAY "* You are about to install C-Kermit on your computer. *" SAY "* Press to cancel at any time. *" SAY "*********************************************************" /* Is IBM TCP/IP installed? */ etcpath = VALUE( "ETC", , "OS2ENVIRONMENT" ) len = LENGTH(etcpath) IF len = 0 THEN tcpip = 0 ELSE DO IF SUBSTR( etcpath, len, 1 ) = ';' THEN DO etcpath = SUBSTR( etcpath, 1, len - 1 ) len = len - 1 END IF SUBSTR( etcpath, len, 1 ) = '\' THEN DO etcpath = SUBSTR( etcpath, 1, len - 1 ) len = len - 1 END tcppath = SUBSTR( etcpath, 1, len - 3 ) IF RexxUtils THEN DO CALL SysFileTree tcppath || "\dll\tcpipdll.dll", 'file', 'FO' tcpip = file.0 END ELSE DO CALL STREAM tcppath || "\dll\tcpipdll.dll", "C", "QUERY EXISTS" IF "\"RESULT <> "\" THEN tcpip = 1 ELSE tcpip = 0 END END /* tcpip is now 1 if installed, or 0 if not */ GETDIR: SAY "" SAY "Please enter the complete path where you want C-Kermit to be installed." SAY "Just press the Enter key to accept the default path, C:\CKERMIT\..." IF SUBSTR(OS2Ver, 1, 1 ) > 1 THEN CALL CHAROUT ,">" PARSE PULL destination /* Use default if nothing was entered */ IF "\"destination = "\" THEN destination = "C:\CKERMIT\" /* Check to make sure there is a trailing backslash */ IF SUBSTR( destination, LENGTH(destination), 1 ) <> "\" THEN destination = destination || "\" /* Check to make sure a drive is specified - use startup drive if not */ installdrive = FILESPEC("DRIVE",destination) IF installdrive = "" THEN installdrive = FILESPEC("DRIVE", startdir) /* Check to make sure a path is specified - use root if not */ installpath = FILESPEC("PATH", destination) IF installpath = "" THEN installpath= "\" /* Build fully qualified destination directory name */ destination = installdrive || installpath /* And guaranteed-uppercase version */ updest = TRANSLATE(destination) /* And a version without a slash */ destnoslash = SUBSTR( destination, 1, LENGTH( destination ) - 1 ) /* Ensure that source and destination directories are different */ IF sourcedir"\" = TRANSLATE(destination) THEN DO SAY "" SAY "The source and destination directories must be different." CALL GETDIR END /* Validate the install drive */ IF RexxUtils THEN IF POS( TRANSLATE( installdrive ), "A: B: " || SysDriveMap() ) <> 0 THEN valid = 1 ELSE valid = 0 ELSE DO 'CMD /C DIR' installdrive '> NUL' IF rc = 0 THEN valid = 1 ELSE valid = 0 END IF \ valid THEN DO SAY "" SAY installdrive "is not a valid drive." CALL GETDIR END /* Confirm destination directory */ SAY "" SAY "You have asked that C-Kermit be installed in" destination || "." SAY "Is this correct? (Yes/No):" CALL Confirmation IF RESULT <> 'Y' THEN CALL GETDIR SAY "" /* Check Available Drive Space */ IF RexxUtils THEN DO PARSE UPPER VALUE SysDriveInfo( installdrive ) WITH sysinfodrive freespace, drivesize volumelabel IF freespace < spacerequired THEN DO SAY "Drive" installdrive "does not have enough free space for C-Kermit." SAY "C-Kermit needs" spacerequired "bytes. Drive" installdrive, "only has" freespace "bytes free." SAY "Enter 'Yes' to choose another drive, or 'No' to cancel." CALL Confirmation IF RESULT = 'Y' THEN CALL GETDIR ELSE DO SAY "" EXIT END END END /* RexxUtils */ SAY "Creating destination directory" destination || "..." IF RexxUtils THEN rc = SysMkDir(SUBSTR(destination,1,LENGTH(destination)-1)) ELSE 'CMD /C MD' SUBSTR(destination,1,LENGTH(destination)-1) '> NUL' SELECT WHEN rc = 0 THEN NOP WHEN ( rc = 5 & RexxUtils ) | ( rc = 1 & \ RexxUtils ) THEN DO SAY "Directory" destination "already exists." SAY "Enter 'Yes' to continue or 'No' to choose a new directory." CALL Confirmation IF RESULT <> 'Y' THEN CALL GETDIR SAY "" END OTHERWISE DO SAY "Can't create destination directory" destination rc = DIRECTORY( startdir ) CALL GETDIR END END GETMODEM: SAY "" SAY "C-Kermit is designed to work with many different brands of modems." SAY "Please choose your preferred modem type from the following list:" SAY "" SAY " attdtdm attisn attmodem att7300" SAY " ccitt-v25bis cermetek concord courier" SAY " df03-ac df100-series df200-series digitel-dt22" SAY " gdc-212a/ed hayes microcom none" SAY " penril pep-telebit racalvadic rolm" SAY " slow-telebit sportster telebit unknown" SAY " usrobotics-212a v32-telebit v42-telebit ventel" SAY "" SAY "Pressing the Enter key by itself selects HAYES..." IF SUBSTR(OS2Ver, 1, 1 ) > 1 THEN CALL CHAROUT ,">" PARSE PULL modem /* Use Hayes if nothing was entered */ IF modem = "" THEN modem = "hayes" umodem = TRANSLATE(modem) IF (umodem \= "ATTDTDM") & (Umodem \= "ATTISN") & (Umodem \= "ATTMODEM"), & (Umodem \= "ATT7300") & (Umodem \= "CCITT-V25BIS"), & (Umodem \= "CERMETEK"), & (Umodem \= "CONCORD") & (Umodem \= "COURIER") & (Umodem \= "DF03-AC"), & (Umodem \= "DF100-SERIES") & (Umodem \= "DF200-SERIES"), & (Umodem \= "DIGITAL-DT22") & (Umodem \= "GDC-212A/ED"), & (Umodem \= "HAYES"), & (Umodem \= "MICROCOM") & (Umodem \= "NONE") & (Umodem \= "PENRIL"), & (Umodem \= "PEP-TELEBIT") & (Umodem \= "RACALVADIC") & (Umodem \= "ROLM"), & (Umodem \= "SLOW-TELEBIT") & (Umodem \= "SPORTSTER"), & (Umodem \= "TELEBIT"), & (Umodem \= "UNKNOWN") & (Umodem \= "USROBOTICS-212A"), & (Umodem \= "V32-TELEBIT"), & (Umodem \= "V42-TELEBIT") & (Umodem \= "VENTEL") THEN DO SAY "'"modem"' is not a valid choice." CALL GETMODEM END SAY "You have chosen '"modem"' as your default modem." SAY "Is this correct? (Yes/No):" CALL Confirmation IF RESULT <> 'Y' THEN CALL GETMODEM GETPORT: SAY "" SAY "C-Kermit can work with all valid serial communication devices." SAY "ISA and EISA machines support COM1 through COM4." SAY "MicroChannel machines support COM1 through COM8." SAY "However, most computers have only COM1 and COM2 regardless of" SAY "their architecture." SAY "" SAY "Please choose the communications port to which your" modem "modem is" SAY "connected. Pressing by itself selects COM1..." IF SUBSTR(OS2Ver, 1, 1 ) > 1 THEN CALL CHAROUT ,">" PARSE PULL port /* Use com1 if nothing was entered */ IF port = "" THEN port = "com1" IF LENGTH( port ) <> 4 | TRANSLATE( SUBSTR( port, 1, 3 ) ) <> "COM", | SUBSTR( port, 4, 1) < 1 | SUBSTR( port, 4, 1 ) > 8 THEN DO SAY "'"port"' is not a valid choice." CALL GETPORT END SAY "You have chosen '"port"' as your default communications port." SAY "Is this correct? (Yes/No):" CALL Confirmation IF RESULT <> 'Y' THEN CALL GETPORT GETSPEED: SAY "" SAY "C-Kermit can communicate at all hardware-supported transmission" SAY "speeds. Please select one of the following speeds, measured in" SAY "bits per second, as the default speed for port" port || "." SAY "" SAY " 50 200 2400 9600 57600" SAY " 75 300 3600 14400 76800" SAY " 110 600 4800 19200 115200" SAY " 150 1200 7200 38400 " SAY "" SAY "Pressing by itself selects 9600 bps..." IF SUBSTR(OS2Ver, 1, 1 ) > 1 THEN CALL CHAROUT ,">" PARSE PULL speed /* Use 9600 if nothing was entered */ IF speed = "" THEN speed = "9600" IF speed <> "50" & speed <> "75" & speed <> "110" & speed <> "150" , & speed <> "200" & speed <> "300" & speed <> "600" & speed <> "1200", & speed <> "2400" & speed <> "3600" & speed <> "4800" & speed <> "7200", & speed <> "9600" & speed <> "14400" & speed <> "19200" & speed <> "38400", & speed <> "57600" & speed <> "76800" & speed <> "115200" THEN DO SAY "'"speed"' is not a valid choice." CALL GETSPEED END SAY "You have chosen '"speed"' as your default transmission speed." SAY "Is this correct? (Yes/No):" CALL Confirmation IF RESULT <> 'Y' THEN CALL GETSPEED GETRUNMODE: IF SUBSTR( OS2Ver, 1, 1 ) = "2" THEN DO SAY "" SAY "C-Kermit may be run either in a full screen session or in a window." SAY "Full screen sessions are faster, window sessions give you access to" SAY "more OS/2 features, like cut and paste. Please select either:" SAY "" SAY " Fullscreen" SAY " Window" SAY "" SAY "Pressing by itself selects Window..." IF SUBSTR(OS2Ver, 1, 1 ) > 1 THEN CALL CHAROUT ,">" PARSE PULL runmode /* Run in a window if nothing was entered */ IF runmode = '' THEN runmode = "Window" Urunmode = TRANSLATE( runmode ) IF Urunmode <> "WINDOW" & Urunmode <> "W" &, Urunmode <> "FULLSCREEN" & Urunmode <> "F" THEN DO SAY "'"runmode"' is not a valid choice." CALL GETRUNMODE END IF Urunmode = "W" THEN runmode = "Window" IF Urunmode = "F" THEN runmode = "Fullscreen" SAY "You have chosen to run C-Kermit in a" runmode "session." SAY "Is this correct? (Yes/No):" CALL Confirmation IF RESULT <> 'Y' THEN CALL GETRUNMODE SAY "" END /* Start to install files */ /* Copy the READ.ME file first. */ CALL Install 'read.me', 'read.me' CKOVer = 0 IF RexxUtils THEN DO CALL SysFileTree "ckoker16.exe", "file", "FO" IF file.0 > 0 THEN CKOVer = 16 END ELSE DO CALL STREAM 'ckoker16.exe', 'c', 'query exists' IF "\"RESULT <> "\" THEN CKOVer = 16 END IF RexxUtils THEN DO CALL SysFileTree "ckoker32.exe", "file", "FO" SELECT WHEN file.0 > 0 & CKOVer = 16 THEN CKOVer = "16/32" WHEN file.0 > 0 & CKOVer = 0 THEN CKOVer = "32" OTHERWISE NOP END END ELSE DO CALL STREAM 'ckoker32.exe', 'c', 'query exists' SELECT WHEN "\"RESULT <> "\" & CKOVer = 16 THEN CKOVer = "16/32" WHEN "\"RESULT <> "\" & CKOVer = 0 THEN CKOVer = "32" OTHERWISE NOP END END SAY "" SAY "Installing the C-Kermit application, CKERMIT.EXE..." SELECT WHEN substr(OS2Ver,1,1) = "1" & (CKOVer = 16 | CKOVer = "16/32") THEN DO CALL Install 'ckoker16.exe', ckermit.exe CALL Install 'ckosysl.ck1', syslevel.cko END WHEN substr(OS2Ver,1,1) = "2" & CKOVer = 16 THEN DO CALL Install 'ckoker16.exe', ckermit.exe CALL Install 'ckosysl.ck1', syslevel.cko END WHEN substr(OS2Ver,1,1) = "2" & (CKOVer = 32 | CKOVer = "16/32") THEN DO CALL Install 'ckoker32.exe', ckermit.exe CALL Install 'ckosysl.ck2', syslevel.cko END OTHERWISE SAY "Can't install" CKOVer"-bit version of C-Kermit on OS/2 version" OS2Ver rc = DIRECTORY( startdir ) EXIT END SAY "" SAY "Installing the C-Kermit Icon..." CALL Install 'ckoker.ico', 'ckermit.ico' SAY "" SAY "Installing documentation for recent C-Kermit updates, CKCKER.UPD..." CALL Install 'ckcker.upd' SAY "" SAY "Installing the C-Kermit 'beware' files, CKCKER.BWR and CKOKER.BWR..." CALL Install 'ckcker.bwr' CALL Install 'ckoker.bwr' SAY "(Please consult these files for hints and tips if you have problems.)" SAY "" SAY "Installing the standard C-Kermit initialization file, CKERMIT.INI..." CALL Install 'ckermit.ini' SAY "" SAY "Installing your C-Kermit customization file, CKERMOD.INI..." /* Backup ckermod.ini if necessary, Read ckermod.ini from diskette, write ckermod.ini to dest directory with modifications from previous dialog. */ CALL Backup 'ckermod.ini' modini = destination"ckermod.ini" os2section = 0 LINEIN( "ckermod.ini", 1, 0 ) DO WHILE lines( "ckermod.ini" ) <> 0 linetxt = LINEIN( "ckermod.ini" ) upperlinetxt = TRANSLATE(linetxt) SELECT WHEN (substr( upperlinetxt, 1, 5) = ':OS/2') & (os2section = 0) THEN DO /* SAY "...Entering OS/2 section" */ rc = LINEOUT( modini, linetxt ) os2section = 1 END WHEN (substr( upperlinetxt, 1, 9 ) = "SET MODEM") & (os2section = 1) THEN rc = LINEOUT( modini, 'set modem' modem ) WHEN (substr( upperlinetxt, 1, 8 ) = "SET PORT") & (os2section = 1) THEN rc = LINEOUT( modini, 'set port' port ) WHEN (substr( upperlinetxt, 1, 9 ) = "SET SPEED") & (os2section = 1) THEN rc = LINEOUT( modini, 'set speed' speed ) WHEN (substr( upperlinetxt, 1, 3 ) = 'END') & (os2section = 1) THEN DO /* SAY "...Leaving OS/2 section" */ rc = LINEOUT( modini, linetxt ) os2section = 0 END OTHERWISE rc = LINEOUT( modini, linetxt ) END END /* Close files */ rc = STREAM( modini, 'C', 'CLOSE' ) rc = STREAM( "ckermod.ini", 'C', 'CLOSE' ) SAY "" SAY "Installing Sample C-Kermit dialing directory file, CKERMIT.KDD..." CALL Install 'ckermit.kdd' SAY "" SAY "Installing sample C-Kermit services directory file, CKERMIT.KSD..." CALL Install 'ckermit.ksd' SAY "" SAY "Installing sample C-Kermit startup file, CKERMIT.CMD..." CALL Install 'ckermit.cmd' SAY "" SAY "Installing C-Kermit extended keyboard definitions file, CKOVTK.INI..." CALL Install 'ckovtk.ini' SAY "" SAY "Installing external protocol hints file, CKOEXP.DOC..." CALL Install 'ckoexp.doc' SAY "" SAY "Installing character-set tables CP437.TXT, CP850.TXT, and LATIN1.TXT..." CALL Install 'cp437.txt' CALL Install 'cp850.txt' CALL Install 'latin1.txt' SAY "" IF RexxUtils THEN DO SAY "Assigning the C-Kermit icon to" updest || CKERMIT.EXE || "..." rc = SysSetIcon( destination || 'ckermit.exe',, destination || 'ckermit.ico' ) SAY "" END /* Build C-Kermit Program Object if version 2.x */ IF RexxUtils & SUBSTR( OS2Ver,1,1 ) = "2" THEN DO IF CKOVer = "16" THEN title = "OS/2 C-Kermit (16-bit)" ELSE title = "OS/2 C-Kermit (32-bit)" classname = 'WPProgram' location = '' IF TRANSLATE(runmode) = "WINDOW" THEN setup = 'EXENAME='destination'ckermit.exe;STARTUPDIR=', destination';PROGTYPE=WINDOWABLEVIO;' ELSE setup = 'EXENAME='destination'ckermit.exe;STARTUPDIR=', destination';PROGTYPE=FULLSCREEN;' option = 'update' SAY "Building C-Kermit Program Object..." rc = SysCreateObject(classname, title, location, setup, option) SAY "" END /* Install dummy TCPIPDLL.DLL if IBM TCP/IP is not installed */ IF tcpip = "0" THEN DO SAY "Installing dummy TCPIPDLL.DLL for non-TCP/IP OS/2 system..." SAY "PLEASE REMEMBER: If you install IBM TCP/IP at a later date:" SAY "" SAY " RENAME or DELETE the file" updest || "TCPIPDLL.DLL." SELECT WHEN substr(OS2Ver,1,1) = "1" & (CKOVer = 16 | CKOVer = "16/32") THEN CALL Install 'ckotcp16.dll', 'tcpipdll.dll' WHEN substr(OS2Ver,1,1) = "2" & CKOVer = 16 THEN CALL Install 'ckotcp16.dll', 'tcpipdll.dll' WHEN substr(OS2Ver,1,1) = "2" & (CKOVer = 32 | CKOVer = "16/32") THEN CALL Install 'ckotcp32.dll', 'tcpipdll.dll' OTHERWISE SAY "Error installing dummy TCPIPDLL.DLL for non-TCP/IP system." rc = DIRECTORY( startdir ) EXIT END SAY "" END SAY "Your CONFIG.SYS file defines several environment variables that determine" SAY "how OS/2 and your applications work. With your permission, this program" SAY "will modify one or two of them:" SAY "" SAY " 1. The C-Kermit directory," destination || ", will be added to your PATH" SAY " to allow C-Kermit to be executed from any OS/2 Command Line session." SAY "" IF tcpip = 0 THEN DO SAY " 2. The C-Kermit directory," destination || ", will be added to your" SAY " LIBPATH so C-Kermit can work properly on your non-TCP/IP system." SAY "" END SAY "Please enter 'Yes' to allow this program to update your CONFIG.SYS file." SAY "A backup copy will be made in the root directory of your boot drive." SAY "Update CONFIG.SYS? (Yes/No):" CALL Confirmation IF RESULT <> 'Y' THEN DO configupdate = 0 SAY "" IF tcpip = 0 THEN DO SAY "" SAY " OK, your CONFIG.SYS file has not been changed, BUT..." SAY "" SAY " Since you do not appear to have TCP/IP installed, it is" SAY " necessary that the CKOTCP" || CKOVer || ".DLL file be copied" SAY " to a directory named in your LIBPATH statement in CONFIG.SYS," SAY " and renamed to TCPIPDLL.DLL. If this is not the case now," SAY " please be sure to copy this file to a directory that is in" SAY " your LIBPATH." END ELSE SAY " OK, your CONFIG.SYS file has not been changed." CALL Done END configupdate = 1 SAY "" /* Back up the existing CONFIG.SYS file. */ IF RexxUtils THEN DO tempname = bootdrive || "\CONFIG.???" backup = SysTempFileName( tempname ) END ELSE DO n = 100 backup = bootdrive || "\CONFIG." || n CALL STREAM backup, 'c', 'query exists' DO WHILE "\"RESULT <> "\" n = n + 1 backup = bootdrive || "\CONFIG." || n CALL STREAM backup, 'c', 'query exists' END END SAY "Backing up CONFIG.SYS to" backup || "..." copy bootdrive || "\Config.Sys" backup "> NUL" SAY "" /* Generate a temporary file name for the new CONFIG.SYS file */ IF RexxUtils THEN DO tempname = bootdrive || "\CONFIG??.INS" temp = SysTempFileName( tempname ) END ELSE DO n = 10 temp = bootdrive || "\CONFIG" || n || ".INS" CALL STREAM temp, 'c', 'query exists' DO WHILE "\"RESULT <> "\" n = n + 1 temp = bootdrive || "\CONFIG" || n || ".INS" CALL STREAM temp, 'c', 'query exists' END END /* Generate the temporary CONFIG.SYS file. */ SAY "Updating CONFIG.SYS..." LINEIN( bootdrive || "\Config.sys", 1, 0 ) DO WHILE lines( bootdrive || "\Config.sys" ) <> 0 linetxt = LINEIN( bootdrive || "\Config.sys" ) upperlinetxt = TRANSLATE(linetxt) SELECT WHEN COMPARE( upperlinetxt, "SET PATH" ) = 9 THEN DO SETLOCAL len = LENGTH(linetxt) rc = VALUE('PATH', SUBSTR( upperlinetxt, 10, len - 10 ),, 'OS2ENVIRONMENT' ) IF RexxUtils THEN ckfound = SysSearchPath( 'PATH', ckermit.exe ) ELSE ckfound = MySearchPath( 'PATH', ckermit.exe ) IF ckfound'\' = '\' THEN IF SUBSTR( linetxt, len, 1 ) = ';' THEN rc = LINEOUT( temp, linetxt || destnoslash || ';' ) ELSE rc = LINEOUT( temp, linetxt || ';' || destnoslash || ';' ) ELSE DO ckpath = FILESPEC('DRIVE', ckfound ) || FILESPEC('PATH', ckfound ) IF ckpath = updest THEN rc = LINEOUT( temp, linetxt ) ELSE DO ckpathnoslash = SUBSTR( ckpath, 1, LENGTH( ckpath ) - 1 ) pos = POS( ckpathnoslash, upperlinetxt ) rc = LINEOUT( temp, SUBSTR( linetxt, 1, pos - 1 ) , || destnoslash';' , || SUBSTR( linetxt, pos, len - pos + 1 ) ) SAY "" SAY " WARNING:" SAY " An earlier version of 'CKERMIT.EXE' exists in", " directory" ckpath || "." END END ENDLOCAL END /* For future enhancements ... (NOTE: This is commented out because it doesn't work yet.) WHEN COMPARE( upperlinetxt, "SET DPATH" ) = 10 THEN DO SETLOCAL len = LENGTH(linetxt) rc = VALUE('DPATH', SUBSTR( upperlinetxt, 11, len - 11 ),, 'OS2ENVIRONMENT' ) IF RexxUtils THEN ckfound = SysSearchPath( 'DPATH', ckermit.ini ) ELSE ckfound = MySearchPath( 'DPATH', ckermit.ini ) IF ckfound'\' = '\' THEN IF SUBSTR( linetxt, len, 1 ) = ';' THEN rc = LINEOUT( temp, linetxt || destnoslash || ';' ) ELSE rc = LINEOUT( temp, linetxt || ';' || destnoslash || ';' ) ELSE DO ckpath = FILESPEC('DRIVE', ckfound ) || FILESPEC('PATH', ckfound ) IF ckpath = updest THEN rc = LINEOUT( temp, linetxt ) ELSE DO ckpathnoslash = SUBSTR( ckpath, 1, LENGTH( ckpath ) - 1 ) pos = POS( ckpathnoslash, upperlinetxt ) rc = LINEOUT( temp, SUBSTR( linetxt, 1, pos - 1 ) , || destnoslash';' , || SUBSTR( linetxt, pos, len - pos + 1 ) ) SAY "" SAY " WARNING:" SAY " An earlier version of 'CKERMIT.INI' exists in", " directory" ckpath || "." END END ENDLOCAL END */ WHEN (COMPARE( upperlinetxt, "LIBPATH" ) = 8) & (tcpip = 0) THEN DO SETLOCAL len = LENGTH(linetxt) rc = VALUE('LIBPATH', SUBSTR( upperlinetxt, 9, len - 9 ),, 'OS2ENVIRONMENT' ) IF RexxUtils THEN ckfound = SysSearchPath( 'LIBPATH', tcpipdll.dll ) ELSE ckfound = MySearchPath( 'LIBPATH', tcpipdll.dll ) IF ckfound'\' = '\' THEN IF SUBSTR( linetxt, len, 1 ) = ';' THEN rc = LINEOUT( temp, linetxt || destnoslash || ';' ) ELSE rc = LINEOUT( temp, linetxt || ';' || destnoslash || ';' ) ELSE DO ckpath = FILESPEC('DRIVE', ckfound ) || FILESPEC('PATH', ckfound ) IF ckpath = updest THEN rc = LINEOUT( temp, linetxt ) ELSE DO ckpathnoslash = SUBSTR( ckpath, 1, LENGTH( ckpath ) - 1 ) pos = POS( ckpathnoslash, upperlinetxt ) rc = LINEOUT( temp, SUBSTR( linetxt, 1, pos - 1 ) , || destnoslash';' , || SUBSTR( linetxt, pos, len - pos + 1 ) ) SAY "" SAY " WARNING:" SAY " An earlier version of 'TCPIPDLL.DLL' exists in", " directory" ckpath || "." END END ENDLOCAL END OTHERWISE rc = LINEOUT( temp, linetxt ) END END /* Close files */ rc = STREAM( temp, 'C', 'CLOSE' ) rc = STREAM( bootdrive || "\Config.sys", 'C', 'CLOSE' ) COPY temp bootdrive || "\Config.sys > NUL" IF RexxUtils THEN rc = SysFileDelete( temp ) ELSE "CMD /C DEL" temp "> NUL" SAY "" SAY " Your CONFIG.SYS file has been updated." SAY " Your old CONFIG.SYS has been copied to " backup || "." SAY " After reading the following message," SAY " Please Shutdown and Restart OS/2." Done: SAY "" SAY "C-Kermit has been successfully installed in the directory" updest || "." SAY "" IF SUBSTR( OS2Ver, 1, 1 ) = "2" THEN SAY " To start C-Kermit from the desktop, click on its icon." IF configupdate THEN SAY " To start C-Kermit from a command window, just type CKERMIT." ELSE DO SAY " To start C-Kermit from a command window, just type CKERMIT," SAY " or if" updest "is not in your PATH, type" updest || "CKERMIT." END SAY "" SAY "Please consult the book 'Using C-Kermit' for complete instructions, and" SAY "also read the update and beware files in " updest "for other important" SAY "information: CKCKER.UPD, CKCKER.BWR, and CKOKER.BWR. If you don't have" SAY "the book, call +1 212 854-3703 (USA) to order." SAY "" IF RexxUtils THEN DO SAY "Press any key to exit from the C-Kermit installation procedure." PARSE UPPER VALUE SysGetKey('NOECHO') WITH confirm END ELSE DO SAY "Press to exit from the C-kermit installation procedure." IF SUBSTR(OS2Ver, 1, 1 ) > 1 THEN CALL CHAROUT ,">" PARSE PULL dummy END rc = DIRECTORY( startdir ) EXIT Install: IF "\"ARG(2) = "\" THEN destname = ARG(1) ELSE destname = ARG(2) CALL Backup destname COPY ARG(1) destination || destname "> NUL" RETURN Backup: IF RexxUtils THEN DO CALL SysFileTree destination || ARG(1), 'file', 'FO' IF file.0 > 0 THEN DO CALL SysFileTree destination || 'BACKUP', 'dir', 'DO' IF dir.0 = 0 THEN CALL SysMkDir destination || 'BACKUP' CALL SysFileTree destination || 'BACKUP\' || ARG(1), 'file', 'FO' IF file.0 > 0 THEN CALL SysFileDelete destination || 'BACKUP\' || ARG(1) COPY destination || ARG(1) destination || 'BACKUP\' || ARG(1) '> NUL' CALL SysFileDelete destination || ARG(1) END END ELSE DO CALL STREAM destination || ARG(1), 'c', 'query exists' IF "\"RESULT <> "\" THEN DO "CMD /C DIR" destination || "BACKUP > NUL" IF RC <> 0 THEN 'CMD /C MD' destination || 'BACKUP > NUL' CALL STREAM destination || "BACKUP\" || ARG(1), 'c', 'query exists' IF "\"RESULT <> "\" THEN "CMD /C DEL" destination || "BACKUP\" || ARG(1) "> NUL" COPY destination || ARG(1) destination || 'BACKUP\' || ARG(1) '> NUL' "CMD /C DEL" destination || ARG(1) END END RETURN Confirmation: retval = "" DO WHILE retval = "" IF SUBSTR(OS2Ver, 1, 1 ) > 1 THEN CALL CHAROUT ,">" PARSE PULL response SELECT WHEN ( TRANSLATE( response ) = 'N' | TRANSLATE( response ) = 'NO' ) THEN retval = 'N' WHEN ( TRANSLATE( response ) = 'Y' | TRANSLATE( response ) = 'YES' ) THEN retval = 'Y' OTHERWISE SAY "" SAY "Invalid response. Please type Y or Yes or N or No." END END RETURN retval /* This procedure duplicates as best as possible the RexxUtil function SysSearchPath. */ MySearchPath: PROCEDURE ; _path = VALUE( ARG(1), , "OS2ENVIRONMENT" ) IF SUBSTR( _path, LENGTH(_path), 1 ) <> ";" THEN _path = _path || ";" PARSE UPPER VAR _path _dir ";" _path DO WHILE ("\"_dir <> "\") | ("\"_path <> "\") CALL STREAM _dir || "\" || ARG(2), 'c', 'query exists' IF "\"RESULT <> "\" THEN RETURN _dir || "\" || ARG(2) ELSE PARSE UPPER VAR _path _dir ";" _path END RETURN "" /* End OS/2 C-Kermit INSTALL.CMD */