home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
TPKERMIT
/
SETSHOW.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-03-25
|
9KB
|
213 lines
(* +FILE+ SETSHOW.PASMSCPM *)
(* ================================================================== *)
(* ShowOptions - Show Parameter Options setting for Kermit. *)
(* *)
(* ================================================================== *)
Procedure ShowOptions ;
Begin (* ShowOptions Procedure *)
ClrScr ; (* Clear the Screen *)
GotoXY(1,2); (* Start at line 2 *)
Writeln(' QK-KERMIT version ',version,Gversion,' - ',Date);
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 Series1 then write('Series/1 ')
else If XonXoff then write('Xon-Xoff ')
else write('Standard ');
writeln(' ( Xon-Xoff Series/1 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 = ',Packetsize,' Timeout = ',Timeout:2,' *');
Writeln(' NumPad = ',NumPad:2,' PadChar = ',PadChar:2,' *');
Write (' Startchar = ',StartChar:2,' EndChar = ',EndChar:2);
Writeln(' * use decimal values ');
Write (' CntrlQuote = ',chr(CntrlQuote),' Bit8Quote = ',chr(Bit8quote));
Writeln(' ! use character values ');
Write (' CheckType = ',chr(CheckType),' RepChar = ',chr(RepChar));
Writeln(' ! use NULL for null character )');
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:comstring);
Const
OP1Table : String[40] = ' 300 600 1200 2400 4800 9600 19.2 ';
OP2Table : String[30] = 'ODD EVEN MARK NONE HALF FULL ';
OP3Table : String[40] = 'XON-XOFF SERIES/1 STANDARD ONE TWO ';
OP4Table : String[40] = 'A: B: C: D: DISK PRINTER ';
PP1Table : String[44] = ' PACKETSIZE TIMEOUT NUMPAD ';
PP2Table : String[44] = 'PADCHAR STARTCHAR ENDCHAR 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,Series,ser1,Stand,stand1,one,two,
A,B,C,D,Disk,Print,print1) ;
PParms = (Pzero,Psize,PTime,PNumPad,PPadChar,
PStartChar,PEndChar,PcntrlQuote,Pbit8Quote,
PChecktype,PRepChar);
Var
Option : comstring ;
OptionTable : String[255];
PParmTable : String[122];
Ix : integer ;
ScanOptions : boolean ;
Procedure SetValue ( var Pvalue : byte );
var I,Retcode : integer ;
Begin (* Set Value *)
Val(Gettoken(Instring),I,Retcode);
If Retcode = 0 then Pvalue := I
else
Begin Writeln('>>> Invalid value specified <<<');Delay(2000);End;
End ; (* Set Value *)
Procedure SetChar ( var Pchar : byte );
Var atoken : string[10];
Begin (* set char *)
Atoken := UpperCase(Gettoken(Instring)) ;
If Atoken = 'NULL' then Pchar := 0 else
If Length(Atoken) = 1 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; Series1 := False; End;
(* Series : Begin XonXoff := True; Series1 := True; End; *)
Series : Begin XonXoff := False; Series1 := True; End;
Stand : Begin XonXoff := False; Series1 := 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: SetValue(Packetsize) ;
PTime: SetValue(Timeout) ;
PNumPad: SetValue(NumPad) ;
PPadChar: SetValue(PadChar) ;
PStartChar: SetValue(StartChar) ;
PEndChar: SetValue(EndChar) ;
PcntrlQuote: SetChar(CntrlQuote) ;
Pbit8Quote: SetChar(Bit8Quote) ;
PChecktype: SetChar(CheckType) ;
PRepChar : SetChar(RepChar) ;
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(' The Following are the valid Kermit Commands :');
Writeln('---------------------------------------------------------------');
Writeln('CONNECT <options> - connect to a remote host as a dumb terminal.');
Writeln(' ');
Writeln('SEND <local-filename > AS <remote-filename> RAW');
Writeln('RECEIVE <remote-filename> AS <local-filename > REPLACE');
Writeln(' ');
Writeln('SET <options> - set option settings.');
Writeln('STATUS - display optional settings and status');
Writeln(' ');
Writeln('DIRECTORY,ERASE,RENAME,TYPE,RUN <filename> - local commands');
Writeln('MKDIR,CHDIR,RMDIR <directoryname> - local commands');
Writeln('REMOTE <commands> - remote commands');
Writeln(' ');
Writeln('LOG <filename> - Record data received in a log file.');
Writeln('TAKE <filename> - Take and execute commands from a file.');
Writeln('DEFINE <dword> <dstring> - define a word to equal a string.');
Writeln('AUDIO,PARMS - toggle options .');
Writeln('QUIT <QuitOption> - 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 *)