Mercurial > hg > xemacs-beta
comparison lisp/comint/telnet.el @ 16:0293115a14e9 r19-15b91
Import from CVS: tag r19-15b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:49:20 +0200 |
parents | 9ee227acff29 |
children | 56c54cf7c5b6 |
comparison
equal
deleted
inserted
replaced
15:ad457d5f7d04 | 16:0293115a14e9 |
---|---|
66 (defvar telnet-interrupt-string "\C-c" "String sent by C-c.")) | 66 (defvar telnet-interrupt-string "\C-c" "String sent by C-c.")) |
67 | 67 |
68 (defvar telnet-count 0 | 68 (defvar telnet-count 0 |
69 "Number of output strings read from the telnet process | 69 "Number of output strings read from the telnet process |
70 while looking for the initial password.") | 70 while looking for the initial password.") |
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 -75 | 76 (defvar telnet-initial-count -75 |
252 (erase-buffer) | 252 (erase-buffer) |
253 (process-send-string process (concat "open " host | 253 (process-send-string process (concat "open " host |
254 (if port (concat " " port) "") | 254 (if port (concat " " port) "") |
255 "\n")) | 255 "\n")) |
256 (setq comint-input-sender 'telnet-simple-send) | 256 (setq comint-input-sender 'telnet-simple-send) |
257 (setq telnet-count telnet-initial-count) | |
258 ;; run last so that hooks can change things. | 257 ;; run last so that hooks can change things. |
259 (telnet-mode)))) | 258 (telnet-mode)))) |
260 | 259 |
261 (defun telnet-mode () | 260 (defun telnet-mode () |
262 "This mode is for using telnet (or rsh) from a buffer to another host. | 261 "This mode is for using telnet (or rsh) from a buffer to another host. |
271 (comint-mode) | 270 (comint-mode) |
272 (setq major-mode 'telnet-mode | 271 (setq major-mode 'telnet-mode |
273 mode-name "Telnet" | 272 mode-name "Telnet" |
274 comint-prompt-regexp telnet-prompt-pattern) | 273 comint-prompt-regexp telnet-prompt-pattern) |
275 (use-local-map telnet-mode-map) | 274 (use-local-map telnet-mode-map) |
275 (set (make-local-variable 'telnet-count) telnet-initial-count) | |
276 (run-hooks 'telnet-mode-hook)) | 276 (run-hooks 'telnet-mode-hook)) |
277 | 277 |
278 ;;;###autoload (add-hook 'same-window-regexps "\\*rsh-[^-]*\\*\\(\\|<[0-9]*>\\)") | 278 ;;;###autoload (add-hook 'same-window-regexps "\\*rsh-[^-]*\\*\\(\\|<[0-9]*>\\)") |
279 | 279 |
280 ;; Berkeley spawn of hell | 280 ;; Berkeley spawn of hell |
286 See also `\\[telnet]'." | 286 See also `\\[telnet]'." |
287 (interactive "sOpen rsh connection to host: ") | 287 (interactive "sOpen rsh connection to host: ") |
288 (require 'shell) | 288 (require 'shell) |
289 (let ((name (concat "rsh-" host))) | 289 (let ((name (concat "rsh-" host))) |
290 (pop-to-buffer (make-comint name remote-shell-program nil host)) | 290 (pop-to-buffer (make-comint name remote-shell-program nil host)) |
291 (setq telnet-count telnet-initial-count) | |
292 ;; | 291 ;; |
293 ;; SunOS doesn't print "unix" in its rsh login banner, so let's get a | 292 ;; SunOS doesn't print "unix" in its rsh login banner, so let's get a |
294 ;; reasonable default here. There do exist non-Unix machines which | 293 ;; reasonable default here. There do exist non-Unix machines which |
295 ;; speak the rsh protocol, but let's hope they print their OS name | 294 ;; speak the rsh protocol, but let's hope they print their OS name |
296 ;; when one connects. | 295 ;; when one connects. |
301 ;; because rsh generally doesn't prompt for a password, and gobbling the | 300 ;; because rsh generally doesn't prompt for a password, and gobbling the |
302 ;; first line that contains "passw" is extremely antisocial. More | 301 ;; first line that contains "passw" is extremely antisocial. More |
303 ;; antisocial than echoing a password, and more likely than connecting | 302 ;; antisocial than echoing a password, and more likely than connecting |
304 ;; to a non-Unix rsh host these days... | 303 ;; to a non-Unix rsh host these days... |
305 ;; | 304 ;; |
306 ;; (set-process-filter (get-process name) 'telnet-initial-filter) | 305 ;; I disagree with the above. -sb |
307 (set-process-filter (get-process name) 'telnet-filter) | 306 ;; |
307 (set-process-filter (get-process name) 'telnet-initial-filter) | |
308 ;; (set-process-filter (get-process name) 'telnet-filter) | |
308 ;; run last so that hooks can change things. | 309 ;; run last so that hooks can change things. |
309 (telnet-mode))) | 310 (telnet-mode))) |
310 | 311 |
311 (provide 'telnet) | 312 (provide 'telnet) |
312 | 313 |