;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:8; Patch-File:T -*-
;;; Patch file for KERMIT version 33.1
;;; Reason:
;;;  Changes to Kermit TCP Telnet to be compatable with old and new TCP systems
;;; Reason:
;;;  change open-tcp-telnet-serial-stream and telnet-h19 to be compatible with both old and new
;;;  TCP system
;;; Written 13-Jul-87 15:26:38 by pld (Peter L. DeWolf) at site LMI Cambridge
;;; while running on Azathoth from band 4
;;; with Experimental System 122.9, Experimental Local-File 73.0, Experimental FILE-Server 22.0, Experimental Unix-Interface 11.0, Experimental Tape 17.1, Experimental Tiger 26.0, Experimental KERMIT 33.0, Experimental ZMail 71.0, Experimental Lambda-Diag 15.0, microcode 1754, SDU Boot Tape 3.12, SDU ROM 102, the old ones.



; From modified file DJ: L.NETWORK.KERMIT; CALLS.LISP#56 at 13-Jul-87 15:26:42
#8R KERMIT#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "KERMIT")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; KERMIT; CALLS  "


(defun open-tcp-telnet-serial-stream (&optional auto-force-output)
  (declare (ignore auto-force-output))
  (enable-telnet-iac)
  (let (host)
    (do-forever
      (setq host (prompt-and-read :string-or-nil "~&Telnet to host: "))
      (when (catch-error (funcall (intern "GET-INTERNET-ADDRESS" "TCP") host))
	(return nil)))
    (format t "~&Connecting to ~S" host)
    (open (format nil "TCP-HOST:~A#TELNET" host)
	  :keyword "Kermit User Telnet"
	  :auto-force-output t
	  :coroutine-input t)))

))

; From modified file DJ: L.NETWORK.KERMIT; CALLS.LISP#56 at 13-Jul-87 15:26:44
#8R KERMIT#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "KERMIT")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; KERMIT; CALLS  "


(defun telnet-h19 (&optional to-host)
  (let ((status-pane terminal-io)
	(command-pane terminal-io)
	(interaction-pane terminal-io)
	(terminal-pane terminal-io)
	(kterm-state (make-instance 'kterm-state))
	(kermit-frame nil))
    (declare (special status-pane command-pane interaction-pane terminal-pane kterm-state
		      kermit-frame))
    (enable-telnet-iac)
    (let ((host to-host))
      (do-forever
	(setq host (or host (prompt-and-read :string-or-nil "~&Telnet to host: ")))
	(when (catch-error (funcall (intern "GET-INTERNET-ADDRESS" "TCP") host))
	  (return nil))
	(setq host nil))
      (format t "~&Connecting to ~S" host)
      (with-open-file (stream (format nil "TCP-HOST:~A#TELNET" host)
			      :keyword "Kermit User Telnet"
			      :auto-force-output t
			      :coroutine-input t)
	(send kterm-state
	      ':make-connection
	      stream
	      terminal-pane)))))


))
