Mercurial > hg > xemacs-beta
comparison lisp/comint/telnet.el @ 74:54cc21c15cbb r20-0b32
Import from CVS: tag r20-0b32
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:04:33 +0200 |
parents | 131b0175ea99 |
children | c7528f8e288d |
comparison
equal
deleted
inserted
replaced
73:e2d7a37b7c8d | 74:54cc21c15cbb |
---|---|
1 ;;; telnet.el --- run a telnet session from within an Emacs buffer | 1 ;;; telnet.el --- run a telnet session from within an Emacs buffer |
2 | 2 |
3 ;;; Copyright (C) 1985, 1988, 1992, 1993, 1994 Free Software Foundation, Inc. | 3 ;;; Copyright (C) 1985, 1988, 1992, 1994 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: William F. Schelter | 5 ;; Author: William F. Schelter |
6 ;; Keywords: comm, unix | 6 ;; Keywords: comm, unix |
7 ;; Maintainer: FSF | 7 ;; Maintainer: FSF |
8 | 8 |
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | 17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 ;; General Public License for more details. | 19 ;; General Public License for more details. |
20 | 20 |
21 ;; You should have received a copy of the GNU General Public License | 21 ;; You should have received a copy of the GNU General Public License |
22 ;; along with XEmacs; see the file COPYING. If not, write to the | 22 ;; along with XEmacs; see the file COPYING. If not, write to the Free |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
24 ;; Boston, MA 02111-1307, USA. | 24 ;; 02111-1307, USA. |
25 | 25 |
26 ;;; Synched up with: FSF 19.30. | 26 ;;; Synched up with: FSF 19.34. |
27 | 27 |
28 ;;; Commentary: | 28 ;;; Commentary: |
29 | 29 |
30 ;; This mode is intended to be used for telnet or rsh to a remode host; | 30 ;; This mode is intended to be used for telnet or rsh to a remode host; |
31 ;; `telnet' and `rsh' are the two entry points. Multiple telnet or rsh | 31 ;; `telnet' and `rsh' are the two entry points. Multiple telnet or rsh |
53 | 53 |
54 (require 'comint) | 54 (require 'comint) |
55 | 55 |
56 (defvar telnet-new-line "\r") | 56 (defvar telnet-new-line "\r") |
57 (defvar telnet-mode-map nil) | 57 (defvar telnet-mode-map nil) |
58 (make-variable-buffer-local 'telnet-new-line) | |
59 (defvar telnet-default-prompt-pattern "^[^#$%>\n]*[#$%>] *") | 58 (defvar telnet-default-prompt-pattern "^[^#$%>\n]*[#$%>] *") |
60 (defvar telnet-prompt-pattern telnet-default-prompt-pattern) | 59 (defvar telnet-prompt-pattern telnet-default-prompt-pattern) |
60 | |
61 (defvar telnet-replace-c-g nil) | 61 (defvar telnet-replace-c-g nil) |
62 (make-variable-buffer-local 'telnet-replace-c-g) | 62 (make-variable-buffer-local |
63 (defvar telnet-remote-echoes t | 63 (defvar telnet-remote-echoes t |
64 "True if the telnet process will echo input.") | 64 "True if the telnet process will echo input.")) |
65 (make-variable-buffer-local 'telnet-remote-echoes) | 65 (make-variable-buffer-local |
66 (defvar telnet-interrupt-string "\C-c" | 66 (defvar telnet-interrupt-string "\C-c" "String sent by C-c.")) |
67 "String sent by C-c.") | |
68 (make-variable-buffer-local 'telnet-interrupt-string) | |
69 | 67 |
70 (defvar telnet-count 0 | 68 (defvar telnet-count 0 |
71 "Number of output strings read from the telnet process | 69 "Number of output strings read from the telnet process |
72 while looking for the initial password.") | 70 while looking for the initial password.") |
73 (make-variable-buffer-local 'telnet-count) | 71 (make-variable-buffer-local 'telnet-count) |
92 | 90 |
93 (defun telnet-c-z () | 91 (defun telnet-c-z () |
94 (interactive) | 92 (interactive) |
95 (process-send-string nil "\C-z")) | 93 (process-send-string nil "\C-z")) |
96 | 94 |
95 ;; XEmacs change (Keep telnet- prefix) | |
97 (defun telnet-send-process-next-char () | 96 (defun telnet-send-process-next-char () |
98 (interactive) | 97 (interactive) |
99 (process-send-string nil | 98 (process-send-string nil |
100 (char-to-string | 99 (char-to-string |
101 (let ((inhibit-quit t)) | 100 (let ((inhibit-quit t)) |
103 (setq quit-flag nil)))))) | 102 (setq quit-flag nil)))))) |
104 | 103 |
105 ; initialization on first load. | 104 ; initialization on first load. |
106 (if telnet-mode-map | 105 (if telnet-mode-map |
107 nil | 106 nil |
108 (progn | 107 ;; FSF |
109 (setq telnet-mode-map (make-sparse-keymap)) | 108 ;; (setq telnet-mode-map (nconc (make-sparse-keymap) comint-mode-map)) |
110 (set-keymap-name telnet-mode-map 'telnet-mode-map) | 109 (setq telnet-mode-map (make-sparse-keymap)) |
111 (set-keymap-parents telnet-mode-map (list comint-mode-map)) | 110 (set-keymap-parents telnet-mode-map (list comint-mode-map)) |
112 (define-key telnet-mode-map "\C-m" 'telnet-send-input) | 111 (define-key telnet-mode-map "\C-m" 'telnet-send-input) |
113 ;;(define-key telnet-mode-map "\C-j" 'telnet-send-input) | 112 ; (define-key telnet-mode-map "\C-j" 'telnet-send-input) |
114 (define-key telnet-mode-map "\C-c\C-q" 'telnet-send-process-next-char) | 113 (define-key telnet-mode-map "\C-c\C-q" 'send-process-next-char) |
115 (define-key telnet-mode-map "\C-c\C-c" 'telnet-interrupt-subjob) | 114 (define-key telnet-mode-map "\C-c\C-c" 'telnet-interrupt-subjob) |
116 (define-key telnet-mode-map "\C-c\C-z" 'telnet-c-z))) | 115 (define-key telnet-mode-map "\C-c\C-z" 'telnet-c-z)) |
117 | 116 |
118 ;;maybe should have a flag for when have found type | 117 ;;maybe should have a flag for when have found type |
119 (defun telnet-check-software-type-initialize (string) | 118 (defun telnet-check-software-type-initialize (string) |
120 "Tries to put correct initializations in. Needs work." | 119 "Tries to put correct initializations in. Needs work." |
121 (let ((case-fold-search t)) | 120 (let ((case-fold-search t)) |
122 (cond ((string-match "unix" string) | 121 (cond ((string-match "unix" string) |
123 (setq telnet-prompt-pattern shell-prompt-pattern) | 122 (setq telnet-prompt-pattern comint-prompt-regexp) |
124 (setq telnet-new-line "\n")) | 123 (setq telnet-new-line "\n")) |
125 ((string-match "tops-20" string) ;;maybe add telnet-replace-c-g | 124 ((string-match "tops-20" string) ;;maybe add telnet-replace-c-g |
126 (setq telnet-prompt-pattern "[@>] *")) | 125 (setq telnet-prompt-pattern "[@>] *")) |
127 ((string-match "its" string) | 126 ((string-match "its" string) |
128 (setq telnet-prompt-pattern "^[^*>\n]*[*>] *")) | 127 (setq telnet-prompt-pattern "^[^*>\n]*[*>] *")) |