Unit SetShow ; Interface uses Crt, (* Standard Turbo Pascal Unit *) KGlobals, (* Kermit Globals *) Modempro, Sysfunc, Packets, Vt100, Tek4010, SendRecv ; Procedure ShowOptions ; Procedure SetOptions (var instring:String); Procedure DisplayCommands; Implementation Type SetofChar = Set of Char ; (* ================================================================== *) (* ShowOptions - Show Parameter Options setting for Kermit. *) (* *) (* ================================================================== *) Procedure ShowOptions ; Begin (* ShowOptions Procedure *) ClrScr ; (* Clear the Screen *) GotoXY(1,1); (* Start at line 1 *) Writeln(' QK-KERMIT version ',version,' - ',Date); Writeln(' ',termtype,' ',graphics ); Writeln(' '); Writeln(' Current Setting Options '); Writeln('------------------- --------------------------------------'); Writeln('Baud Rate = ',Baudrate,' ( 300 600 1200 2400 4800 9600 19.2 )'); Write ('Parity = ') ; Case paritytype(parity) of OddP : write('Odd '); EvenP: write('Even '); MarkP: write('Mark '); NoneP: write('None '); end ; (* parity case *) Writeln(' ( Odd Even Mark None ) '); Write ('Duplex = '); If LocalEcho then Write('Half ') else Write('Full '); writeln(' ( Half Full ) '); Write ('Protocol = '); If NoEcho then write('NoEcho ') else If XonXoff then write('IBM-Xon ') else write('Standard '); writeln(' ( IBM-Xon NoEcho Standard )'); Writeln(' '); Write ('Disk Drive = ',chr(DefaultDrive+$41),': ') ; writeln(' ( A: B: C: D: )'); Write ('Com Port = '); If PrimaryPort then Write('One ') else Write('Two '); writeln(' ( One Two ) ' ); Write ('Destination='); If ForPrinter then Write(' Printer ') else Write(' Disk '); writeln(' ( Disk Printer )'); Writeln(' '); If ParmFlag then Begin (* Display Packet Parameters *) Writeln('-------------------------------------------------------------'); Writeln('Packet Parameters'); Writeln(' Packetsize = ',sPacketsize,' Timeout = ',sTimeout:2,' *'); Writeln(' NumPad = ',sNumPad:2,' PadChar = ',sPadChar:2,' *'); Write (' Startchar = ',StartChar:2,' EolChar = ',sEolChar:2); Writeln(' * use decimal values '); Write (' CntrlQuote = ',chr(sCntrlQuote),' Bit8Quote = ',chr(Bit8quote)); Writeln(' | use character values '); Write (' CheckType = ',chr(CheckType),' RepChar = ',chr(RepChar)); Writeln(' | use NULL for null character )'); Writeln(' RemotePacketsize = ',rPacketsize); End ; (* Display Packet Parameters *) If logging then Begin writeln(' '); writeln(' Logging data to file ',LogName); end; End; (* ShowOptions Procedure *) (* ================================================================== *) (* SetOptions - Set Parameter Options setting for Kermit. *) (* *) (* ================================================================== *) Procedure SetOptions (var instring:String); Const OP1Table : String[40] = ' 300 600 1200 2400 4800 9600 19.2 '; OP2Table : String[30] = 'ODD EVEN MARK NONE HALF FULL '; OP3Table : String[40] = 'IBM-XON NOECHO STANDARD ONE TWO '; OP4Table : String[40] = 'A: B: C: D: DISK PRINTER '; PP1Table : String[44] = ' PACKETSIZE TIMEOUT NUMPAD '; PP2Table : String[44] = 'PADCHAR STARTCHAR EOLCHAR CNTRLQUOTE '; PP3Table : String[33] = 'BIT8QUOTE CHECKTYPE REPCHAR ' ; Type Options = (zero,b300,b600,b1200,b2400,b4800,b9600,b19200, PO,PE,PM,PN,HALF,FULL, Xon,xon1,NoEcho1,noecho2,Stand,stand1,one,two, A,B,C,D,Disk,Print,print1) ; PParms = (Pzero,Psize,PTime,PNumPad,PPadChar, PStartChar,PEolChar,PcntrlQuote,Pbit8Quote, PChecktype,PRepChar); Var Option : String ; OptionTable : String[255]; PParmTable : String[122]; Ix : integer ; ScanOptions : boolean ; Function GetValue ( MinVal,MaxVal : integer) : integer ; var I,Retcode : integer ; Begin (* Get Value *) Val(Gettoken(Instring),I,Retcode); If (Retcode=0) and (I>=MinVal) and (I<= MaxVal) then GetValue := I else Begin GetValue := MinVal ; Writeln('>>> Invalid value specified <<<'); Delay(2000); End; End ; (* Get Value *) Procedure SetChar ( var Pchar : byte ; ValidChars : setofchar ); Var atoken : string[10]; Begin (* set char *) Atoken := UpperCase(Gettoken(Instring)) ; If Atoken = 'NULL' then Pchar := $20 else If (Length(Atoken)=1) and (Atoken[1] in ValidChars) then Pchar := Ord(Atoken[1]) else Begin Writeln('>>> Invalid Specification <<<');delay(2000);End; End ; (* set char *) Begin (* SetOptions Procedure *) OptionTable := OP1Table + OP2Table + OP3Table + OP4Table ; PParmTable := PP1Table + PP2Table + PP3Table ; If length(instring)<1 then Begin (* Get Settings *) ShowOptions; Write ('Enter Option Setting >'); (* If audioflag then *) Begin Sound(1000); Delay(250); Sound(2000); Delay(50); Nosound;end; Readln(instring); End ; (* Get Settings *) ScanOptions := true ; While (length(instring)>0) and ScanOptions do Begin (* Parse instring *) Option := GetToken(instring); ScanOptions := Option<>';'; Option := Concat(' ',Uppercase(Option)); ix := Pos(Option,OptionTable) div 5 ; If ix <> 0 then Case Options(ix) of b300 : Baudrate := 300 ; b600 : Baudrate := 600 ; b1200 : Baudrate := 1200 ; b2400 : Baudrate := 2400 ; b4800 : Baudrate := 4800 ; b9600 : Baudrate := 9600 ; b19200 : Baudrate := 19200 ; PO : Parity := OddP ; PE : parity := EvenP ; PM : Parity := MarkP ; PN : parity := NoneP ; HALF : LocalEcho:= True ; FULL : LocalEcho:= False ; Xon : Begin XonXoff := True; NoEcho := False; End; NoEcho1: Begin XonXoff := False; NoEcho := True; End; Stand : Begin XonXoff := False; NoEcho := False; End; One : PrimaryPort := True ; Two : PrimaryPort := False ; A : SetDefaultDrive(0) ; B : SetDefaultDrive(1) ; C : SetDefaultDrive(2) ; D : SetDefaultDrive(3) ; Disk : ForPrinter := false ; Print : ForPrinter := true ; End (* case of options *) else Begin (* check packet parms *) ix := Pos(Option,PParmTable) div 11 ; If (ix <> 0) and ParmFlag then Case PParms(ix) of Psize: sPacketsize := GetValue(10,MaxPacketSize) ; PTime: sTimeout := GetValue(0,255) ; PNumPad: sNumPad := GetValue(0,255) ; PPadChar: sPadChar := GetValue(0,127) ; PStartChar: StartChar := GetValue(1,31) ; PEolChar: sEolChar := GetValue(1,31) ; PcntrlQuote: SetChar(sCntrlQuote,['!'..'/']) ; Pbit8Quote: SetChar(Bit8Quote,['!'..'>','`'..'~','Y','N']) ; PChecktype: SetChar(CheckType,['1'..'3']) ; PRepChar : SetChar(RepChar,['!'..'>','`'..'~'] - [chr(sCntrlQuote),chr(Bit8Quote)] ); End ; (* Case of PParms *) If chr(CheckType) in ['1','2','3'] then else CheckType := 49 ; End ; (* check packet parms *) ResetModem; Initmodem ; SetModem ; End ; (* Parse instring *) ShowOptions ; End ; (* SetOptions Procedure *) (* ================================================================== *) (* DisplayCommands - Display all the valid Kermit Commands. *) (* *) (* ================================================================== *) Procedure DisplayCommands; Begin (* DisplayCommands Procedure *) ClrScr ; Writeln(' ( Q K - K E R M I T COMMANDS )'); Writeln('-----------------------------------------------------------------'); Writeln('CONNECT - connect to a remote host as a dumb terminal.'); Writeln('WAIT - wait for a connection to be made.'); Writeln('SEND AS RAW'); Writeln('RECEIVE AS REPLACE'); Writeln('SET - set option settings.'); Writeln('STATUS - display optional settings and status'); Writeln(' '); Writeln('DIRECTORY,ERASE,RENAME,TYPE,RUN - local commands'); Writeln('MKDIR,CHDIR,RMDIR - local commands'); Writeln('REMOTE - remote commands'); Writeln(' '); Writeln('LOG - Record data received in a log file.'); Writeln('TAKE - Take and execute commands from a file.'); Writeln(' also see script commands CLEAR,INPUT,OUTPUT,ECHO,PAUSE '); Writeln('DEFINE - define a word to equal a string.'); Writeln('AUDIO,PARMS,LINE25 - toggle options .'); Writeln('QUIT - terminate local or remote kermit program.'); Writeln(' QuitOptions : LOCAL,REMOTE,DISCONnect,ALL'); Writeln(' '); Writeln(' Note: All parameters are optional and all commands maybe'); Writeln(' abbreviated to a minimum of unique characters.'); Writeln('---------------------------------------------------------------'); End; (* DisplayCommand Procedure *) end.