home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
TPKERMIT
/
MISCCOMM.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-03-25
|
4KB
|
104 lines
(* +FILE+ MISCCOMM.PASMSCPM *)
(* ================================================================== *)
(* LOGIT - creates a Log file to record all incoming data from the *)
(* remote line. *)
(* The file name is specified in the Parameter . *)
(* if no parameter specified logging is turned off. *)
(* ================================================================== *)
Procedure Logit (filename : comstring);
Begin (* Logit Procedure *)
If (length(filename) < 3) or (filename='OFF') then
Begin (* Turn off Logging *)
Logging := false ;
Close (Logfile);
Writeln (' Logging is turned off ');
End (* Turn off Logging *)
else
Begin (* Turn on Logging *)
If Logging then Close (Logfile);
Logging := True ;
Assign(Logfile,Filename);
Rewrite(Logfile);
Writeln(' Logging data to file ',filename);
LogName := filename ;
End ; (* Turn on Logging *)
End ; (* Logit Procedure)
(* ================================================================== *)
(* Takeit - read commands from a file and executes them. *)
(* if no file specified or file is not there if does nothing *)
(* ================================================================== *)
Procedure Takeit (filename : comstring);
Begin (* Takeit Procedure *)
If length(filename) > 1 then
If Firstfile(filename,dummy) then
Begin (* Active file *)
Writeln ('Activating Command file ',filename);
ActiveCommandfile := true ;
Assign(Commandfile,filename);
Reset(Commandfile);
End (* Active file *)
else
Writeln('No file ',filename) ;
End ; (* Takeit Procedure)
(* ================================================================== *)
(* QuitExit - Terminates the KERMIT. *)
(* the QuitOptions are: *)
(* LOCAL,REMOTE,DISCONnect,ALL *)
(* if LOCAL or noparms only the local kermit terminates.*)
(* if REMOTE then only the remote kermit terminates. *)
(* if DISCONect then the remote kermit is terminated *)
(* and the remote is logged off. *)
(* if ALL then both kermits are terminated and remote *)
(* is logged off. *)
(* *)
(* ================================================================== *)
Procedure QuitExit (QuitOption : comstring);
Const
QuitTable : String[35] = ' LOCAL REMOTE DISCON ALL ' ;
Type QuitType = (zero,local,remote,discon,all);
Var
Qix : integer ;
Begin (* QuitExit Procedure *)
QuitOption := Uppercase(Concat(' ',QuitOption));
Qix := Pos(QuitOption,QuitTable) div 7 ;
Case QuitType(Qix) of (* Quit Type *)
zero,
local: Running := false ;
remote :
Begin (* terminate remote kermit *)
(* Send a Finish packet *)
OutDataCount := 1 ;
OutSeq := OutSeq + 1 ;
If OutSeq > 64 then OutSeq := 0 ;
OutPacketType := Ord('G');
SendData[1] := Ord('F');
WaitXon := False ;
SendPacket ;
If RecvPacket and (InPacketType = Ord('Y')) then
Writeln (' Remote Kermit terminated. ')
else
Writeln(' Unable to terminate Remote Kermit. ');
End ; (* terminate remote kermit *)
discon,
all:
Begin (* logoff Remote *)
(* Send a Logoff packet *)
OutDataCount := 1 ;
OutSeq := OutSeq + 1 ;
If OutSeq > 64 then OutSeq := 0 ;
OutPacketType := Ord('G');
SendData[1] := Ord('L');
WaitXon := false ;
SendPacket ;
If RecvPacket and (InPacketType = Ord('Y')) then
Writeln (' Remote host is logging off ')
else
Writeln(' Remote host unable to execute a log off ');
If (Qix = Ord(all)) then Running := False ;
End; (* Logoff Remote *)
End ; (* Case Quit Type *)
End; (* QuitExit Procedure *)