4.3BSD/usr/contrib/emacs/lisp/telnet.elc


(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))

(if telnet-mode-map nil (setq telnet-mode-map (make-keymap)) (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 kill-shell-input)) (define-key telnet-mode-map "" (quote backward-kill-word)) (define-key telnet-mode-map "" (quote telnet-interrupt-subjob)) (define-key telnet-mode-map "" (quote telnet-c-z)))

(defun telnet-check-software-type-initialize (string) "\
Tries to put correct initializations in.  Needs work." (byte-code "ÅÆ\"ƒ
‰ˆÇ‰‚5ÅÈ\"ƒɉ‚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 "ÆÇ\"ƒÈ	\"ˆÉ ‰ˆÊ‰ˆË	
P\"‚@
…@Ì!ˆÈ	\"ˆÍVƒ8Î	È\"‚@
…@T‰‡" [string proc password telnet-count telnet-new-line t string-match "passw" telnet-filter read-password 0 send-string telnet-check-software-type-initialize 4 set-process-filter] 9))

(defun telnet-filter (proc string) (byte-code "ŠÇ!qˆdbˆ`
cˆÈ	`ÉÊ$ˆ…È	`Ë$)ˆÌ!ƒ0ÍÌ!`\"‚1ΈÏ!…?Ð!…?
ƒJÑ\"‚KÎ)ˆÇ!p=ƒZdb‚[·" [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 nil 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ˆ
‰ˆÊ
`\")ˆŠ	bˆÌp!Ò	
#ˆ?ƒbÓ\"‚cĈÔË!`\")))‡" [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 "ÂÃr‰ÄU?…Å	!P‰ˆ‚ˆ*‡" [answ tem "" nil 13 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!).

 \\[telnet-send-input] Causes the last string of input to be sent to remote host
 \\[delete-char-or-send-eof] Will delete a character (or send eof if it is the last character.
 \\[kill-shell-input]  Kills the last shell-input
 \\[backward-kill-word] runs backward-kill-word.
 \\[send-process-next-char] sends the next keystroke directly without
interpretation eg. useful for sending c-q or ` ' to continue typeout
with more processing.
 \\[telnet-interrupt-subjob] interrupts the current program running on the remote host.
 \\[telnet-c-z] Sends a c-z to the remote host

Bugs:
--Replace 
 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-format 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" "--%1*%1*-Emacs: %17b   %M   %[(%m: %s)%]----%3p--%-" make-local-variable use-local-map "" "
" make-marker] 14))