comparison lisp/comint/telnet.el @ 48:56c54cf7c5b6 r19-16b90

Import from CVS: tag r19-16b90
author cvs
date Mon, 13 Aug 2007 08:56:04 +0200
parents 0293115a14e9
children 131b0175ea99
comparison
equal deleted inserted replaced
47:11c6df210d7f 48:56c54cf7c5b6
51 ;; needs hacking if it is going to deal with asynchronous output in a sane 51 ;; needs hacking if it is going to deal with asynchronous output in a sane
52 ;; manner 52 ;; manner
53 53
54 (require 'comint) 54 (require 'comint)
55 55
56 (defgroup telnet nil
57 "Telnet/rsh stuff"
58 :group 'comint)
59
56 (defvar telnet-new-line "\r") 60 (defvar telnet-new-line "\r")
57 (defvar telnet-mode-map nil) 61 (defvar telnet-mode-map nil)
58 (defvar telnet-default-prompt-pattern "^[^#$%>\n]*[#$%>] *") 62 (defvar telnet-default-prompt-pattern "^[^#$%>\n]*[#$%>] *")
59 (defvar telnet-prompt-pattern telnet-default-prompt-pattern) 63 (defvar telnet-prompt-pattern telnet-default-prompt-pattern)
60 64
68 (defvar telnet-count 0 72 (defvar telnet-count 0
69 "Number of output strings read from the telnet process 73 "Number of output strings read from the telnet process
70 while looking for the initial password.") 74 while looking for the initial password.")
71 ;; (make-variable-buffer-local 'telnet-count) 75 ;; (make-variable-buffer-local 'telnet-count)
72 76
73 (defvar telnet-program "telnet" 77 (defcustom telnet-program "telnet"
74 "Program to run to open a telnet connection.") 78 "*Program to run to open a telnet connection."
79 :group 'telnet)
80
81 (defcustom rsh-eat-password-string nil
82 "Non-nil means rsh will look for a string matching a password prompt."
83 :type 'boolean
84 :group 'telnet)
75 85
76 (defvar telnet-initial-count -75 86 (defvar telnet-initial-count -75
77 "Initial value of `telnet-count'. Should be set to the negative of the 87 "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.") 88 number of terminal writes telnet will make setting up the host connection.")
79 89
117 ;;maybe should have a flag for when have found type 127 ;;maybe should have a flag for when have found type
118 (defun telnet-check-software-type-initialize (string) 128 (defun telnet-check-software-type-initialize (string)
119 "Tries to put correct initializations in. Needs work." 129 "Tries to put correct initializations in. Needs work."
120 (let ((case-fold-search t)) 130 (let ((case-fold-search t))
121 (cond ((string-match "unix" string) 131 (cond ((string-match "unix" string)
122 (setq telnet-prompt-pattern comint-prompt-regexp) 132 (setq telnet-prompt-pattern shell-prompt-pattern)
123 (setq telnet-new-line "\n")) 133 (setq telnet-new-line "\n"))
124 ((string-match "tops-20" string) ;;maybe add telnet-replace-c-g 134 ((string-match "tops-20" string) ;;maybe add telnet-replace-c-g
125 (setq telnet-prompt-pattern "[@>] *")) 135 (setq telnet-prompt-pattern "[@>] *"))
126 ((string-match "its" string) 136 ((string-match "its" string)
127 (setq telnet-prompt-pattern "^[^*>\n]*[*>] *")) 137 (setq telnet-prompt-pattern "^[^*>\n]*[*>] *"))
302 ;; antisocial than echoing a password, and more likely than connecting 312 ;; antisocial than echoing a password, and more likely than connecting
303 ;; to a non-Unix rsh host these days... 313 ;; to a non-Unix rsh host these days...
304 ;; 314 ;;
305 ;; I disagree with the above. -sb 315 ;; I disagree with the above. -sb
306 ;; 316 ;;
307 (set-process-filter (get-process name) 'telnet-initial-filter) 317 (set-process-filter (get-process name) (if rsh-eat-password-string
318 'telnet-initial-filter
319 'telnet-filter))
308 ;; (set-process-filter (get-process name) 'telnet-filter) 320 ;; (set-process-filter (get-process name) 'telnet-filter)
309 ;; run last so that hooks can change things. 321 ;; run last so that hooks can change things.
310 (telnet-mode))) 322 (telnet-mode)))
311 323
312 (provide 'telnet) 324 (provide 'telnet)