(defvar telnet-new-line "

(defvar telnet-mode-map nil)

(defvar telnet-prompt-pattern "^[^#$%>]*[#$%>] *")

(defvar telnet-interrupt-string "" "\
String sent by C-c.")

(defvar telnet-count 0)

(defvar telnet-replace-c-g nil)

(defvar telnet-remote-echoes nil)

(defun telnet-interrupt-subjob nil (interactive) (byte-code "ˆ	\"" [nil telnet-interrupt-string "Interrupt the program running through telnet on the remote host." send-string] 3))

(defun telnet-c-z nil (interactive) (byte-code "\"" [nil send-string ""] 3))

(defun send-process-next-char nil (interactive) (byte-code "r)!\"" [nil inhibit-quit t quit-flag send-string char-to-string] 6))

(setq telnet-mode-map (make-sparse-keymap))

(progn (define-key telnet-mode-map "
" (quote telnet-send-input)) (define-key telnet-mode-map "
" (quote telnet-send-input)) (define-key telnet-mode-map "" (quote shell-send-eof)) (define-key telnet-mode-map "" (quote send-process-next-char)) (define-key telnet-mode-map "" (quote telnet-interrupt-subjob)) (define-key telnet-mode-map "" (quote telnet-c-z)) (define-key telnet-mode-map "" (quote kill-shell-input)) (define-key telnet-mode-map "" (quote backward-kill-word)) (define-key telnet-mode-map "" (quote kill-output-from-shell)) (define-key telnet-mode-map "" (quote show-output-from-shell)))

(defun telnet-check-software-type-initialize (string) "\
Tries to put correct initializations in.  Needs work." (byte-code "\"
lj5\"ɉ5\"+ˉ5\"5͉" [string telnet-prompt-pattern shell-prompt-pattern telnet-new-line telnet-replace-c-g string-match "unix" "
" "tops-20" "[@>]*" "its" "^[^*>]*[*>] *" "explorer" 10] 6))

(defun telnet-initial-filter (proc string) (byte-code "\"	!!!N\"4	\" )ω	
P\"N!	\"VJ	\"NT" [string proc echo-keystrokes password telnet-count telnet-new-line t string-match "No such host" kill-buffer process-buffer error "No such host." "passw" telnet-filter 0 read-password send-string telnet-check-software-type-initialize 4 set-process-filter] 13))

(defun telnet-filter (proc string) (byte-code "!qdb`
c	`$	`$)!-!`\"!;!;
C\")!p=Odb" [proc now string telnet-replace-c-g last-input-start telnet-remote-echoes last-input-end process-buffer subst-char-in-region 13 32 7 process-mark set-marker integer-or-marker-p marker-position delete-region] 12))

(defun delete-char-or-send-eof (arg killp) "\
At end of buffer, send eof to subshell.  Otherwise delete character." (interactive "p
P") (byte-code "ˆm? 	\"" [killp arg nil process-send-eof delete-char] 4))

(defun telnet-send-input nil "\
Send input to remote host
At end of buffer, sends all text after last output
as input to the telnet, including a telnet-new-line inserted at the end.
Not at end, copies current line to the end of the buffer and sends it,
after first attempting to discard any prompt at the beginning of the line
by matching the regexp that is the value of telnet-prompt-pattern if possible." (interactive) (byte-code "Ĉ m	p!!\"
`\"C #`!`\"db	`\"cʼn
`\")	bp!	
#?_\"!`\")))" [copied last-input-start last-input-end telnet-prompt-pattern nil t copy process telnet-new-line end-of-line move-marker process-mark get-buffer-process beginning-of-line re-search-forward buffer-substring forward-line 1 send-region send-string set-marker] 18))

(defun telnet (arg) "\
Open a network login connection to host named HOST (a string).
Communication with HOST is recorded in a buffer *HOST-telnet*.
Normally input is edited in Emacs and sent a line at a time." (interactive "sOpen telnet connection to host: ") (byte-code "È!	P\"!!\" 	Q\" ҉)" [name arg telnet-count nil require shell "-telnet" switch-to-buffer make-shell "telnet" set-process-filter get-process telnet-initial-filter erase-buffer send-string "open " "
" telnet-mode -16] 11))

(defun read-password nil (byte-code "rU	U?	!P*" [answ tem "" nil 13 10 char-to-string] 4))

(defun telnet-mode nil "\
This mode is for use during telnet from a buffer to another
host. It has most of the same commands as shell mode.
There is a variable `telnet-interrupt-string' which is the character
sent to try to stop execution of a job on the remote host.
Data is sent to the remote host when `return' is typed.
Thus if you may need to edit the data before sending you
should use c-n to move down a line.  Then you can return
to alter a previous line.  Of course you should not use this
mode of telnet if you want to run emacs like programs on the
remote host (at least not yet!).

The following commands imitate the usual Unix interrupt and
editing control characters:

 by a space, really should remove.
--For Unix interacts poorly with tcsh although csh,sh,ksh are ok." (interactive) (byte-code "͈ ωЉщ!!
!)!ԉ!Չ! ! 	!ˉ
!͉" [major-mode mode-name mode-line-process telnet-mode-map tem telnet-prompt-pattern telnet-interrupt-string telnet-new-line last-input-start last-input-end telnet-remote-echoes t telnet-replace-c-g nil kill-all-local-variables telnet-mode "Telnet" (": %s") make-local-variable use-local-map "" "
" make-marker] 14))