comparison lisp/comint/telnet.el @ 14:9ee227acff29 r19-15b90

Import from CVS: tag r19-15b90
author cvs
date Mon, 13 Aug 2007 08:48:42 +0200
parents bcdc7deadc19
children 0293115a14e9
comparison
equal deleted inserted replaced
13:13c6d0aaafe5 14:9ee227acff29
71 (make-variable-buffer-local 'telnet-count) 71 (make-variable-buffer-local 'telnet-count)
72 72
73 (defvar telnet-program "telnet" 73 (defvar telnet-program "telnet"
74 "Program to run to open a telnet connection.") 74 "Program to run to open a telnet connection.")
75 75
76 (defvar telnet-initial-count -50 76 (defvar telnet-initial-count -75
77 "Initial value of `telnet-count'. Should be set to the negative of the 77 "Initial value of `telnet-count'. Should be set to the negative of the
78 number of terminal writes telnet will make setting up the host connection.") 78 number of terminal writes telnet will make setting up the host connection.")
79 79
80 (defvar telnet-maximum-count 4 80 (defvar telnet-maximum-count 4
81 "Maximum value `telnet-count' can have. 81 "Maximum value `telnet-count' can have.
128 ((string-match "explorer" string) ;;explorer telnet needs work 128 ((string-match "explorer" string) ;;explorer telnet needs work
129 (setq telnet-replace-c-g ?\n)))) 129 (setq telnet-replace-c-g ?\n))))
130 (setq comint-prompt-regexp telnet-prompt-pattern)) 130 (setq comint-prompt-regexp telnet-prompt-pattern))
131 131
132 (defun telnet-initial-filter (proc string) 132 (defun telnet-initial-filter (proc string)
133 ;For reading up to and including password; also will get machine type. 133 (let ((case-fold-search t))
134 (cond ((string-match "No such host" string) 134 ;For reading up to and including password; also will get machine type.
135 (kill-buffer (process-buffer proc)) 135 (cond ((string-match "No such host" string)
136 (error "No such host.")) 136 (kill-buffer (process-buffer proc))
137 ((string-match "passw" string) 137 (error "No such host."))
138 (telnet-filter proc string) 138 ((string-match "passw" string)
139 (let ((password (comint-read-noecho "Password: " t)))
140 (setq telnet-count 0)
141 (process-send-string proc (concat password telnet-new-line))))
142 (t (telnet-check-software-type-initialize string)
143 (telnet-filter proc string) 139 (telnet-filter proc string)
144 (cond ((> telnet-count telnet-maximum-count) 140 (let ((password (comint-read-noecho "Password: " t)))
145 ;; (set-process-filter proc 'telnet-filter) 141 (setq telnet-count 0)
146 ;; Kludge for shell-fonts -- this is the only mode that 142 (process-send-string proc (concat password telnet-new-line))))
147 ;; actually changes what its process filter is at run time, 143 (t (telnet-check-software-type-initialize string)
148 ;; which confuses shell-font. So we special-case that here. 144 (telnet-filter proc string)
149 ;; #### Danger, knows an internal shell-font variable name. 145 (cond ((> telnet-count telnet-maximum-count)
150 (let ((old-filter (process-filter proc))) 146 ;; (set-process-filter proc 'telnet-filter) Kludge
151 (if (eq old-filter 'shell-font-process-filter) 147 ;; for shell-fonts -- this is the only mode that
152 (set (make-local-variable 'shell-font-process-filter) 148 ;; actually changes what its process filter is at
153 'telnet-filter) 149 ;; run time, which confuses shell-font. So we
154 (set-process-filter proc 'telnet-filter)))) 150 ;; special-case that here.
155 (t (setq telnet-count (1+ telnet-count))))))) 151 ;; #### Danger, knows an internal shell-font variable name.
152 (let ((old-filter (process-filter proc)))
153 (if (eq old-filter 'shell-font-process-filter)
154 (set (make-local-variable 'shell-font-process-filter)
155 'telnet-filter)
156 (set-process-filter proc 'telnet-filter))))
157 (t (setq telnet-count (1+ telnet-count))))))))
156 158
157 ;; Identical to comint-simple-send, except that it sends telnet-new-line 159 ;; Identical to comint-simple-send, except that it sends telnet-new-line
158 ;; instead of "\n". 160 ;; instead of "\n".
159 (defun telnet-simple-send (proc string) 161 (defun telnet-simple-send (proc string)
160 (comint-send-string proc string) 162 (comint-send-string proc string)