Mercurial > emacs
annotate lisp/rlogin.el @ 4729:fdbcbaea7296
(perldb): New function, plus subroutines.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 16 Sep 1993 20:02:25 +0000 |
parents | 3bf9019e5c39 |
children | 896f3b49b53c |
rev | line source |
---|---|
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2231
diff
changeset
|
1 ;;; rlogin.el --- remote login interface |
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2231
diff
changeset
|
2 |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
3 ;; Author: Noah Friedman |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2231
diff
changeset
|
4 ;; Maintainer: Noah Friedman <friedman@prep.ai.mit.edu> |
2259 | 5 ;; Keywords: unix, comm |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2231
diff
changeset
|
6 |
2387
cb44857cab89
moby rlogin-filter fixes
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
7 ;; Copyright (C) 1992, 1993 Free Software Foundation, Inc. |
2315
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
8 ;; |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
9 ;; This program is free software; you can redistribute it and/or modify |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
11 ;; the Free Software Foundation; either version 2, or (at your option) |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
12 ;; any later version. |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
13 ;; |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
14 ;; This program is distributed in the hope that it will be useful, |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
17 ;; GNU General Public License for more details. |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
18 ;; |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
20 ;; along with this program; if not, write to: The Free Software Foundation, |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
21 ;; Inc.; 675 Massachusetts Avenue.; Cambridge, MA 02139, USA. |
2231 | 22 |
2315
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
23 ;;; Commentary: |
9e7ec92a4fdf
Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2259
diff
changeset
|
24 |
2387
cb44857cab89
moby rlogin-filter fixes
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
25 ;; Support for remote logins using `rlogin'. |
2231 | 26 |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2231
diff
changeset
|
27 ;;; Code: |
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2231
diff
changeset
|
28 |
2231 | 29 (require 'comint) |
4685 | 30 (require 'shell) |
2231 | 31 |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
32 ;;;###autoload |
2231 | 33 (defvar rlogin-program "rlogin" |
34 "*Name of program to invoke rlogin") | |
35 | |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
36 ;;;###autoload |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
37 (defvar rlogin-explicit-args nil |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
38 "*List of arguments to pass to rlogin on the command line.") |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
39 |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
40 ;;;###autoload |
2231 | 41 (defvar rlogin-mode-hook nil |
42 "*Hooks to run after setting current buffer to rlogin-mode.") | |
43 | |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
44 ;;;###autoload |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
45 (defvar rlogin-process-connection-type nil |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
46 "*If non-`nil', use a pty for the local rlogin process. |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
47 If `nil', use a pipe (if pipes are supported on the local system). |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
48 |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
49 Generally it is better not to waste ptys on systems which have a static |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
50 number of them. On the other hand, some implementations of `rlogin' assume |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
51 a pty is being used, and errors will result from using a pipe instead.") |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
52 |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
53 ;; Leave this nil because it makes rlogin-filter a tiny bit faster. Plus |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
54 ;; you can still call rlogin-password by hand. |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
55 ;;;###autoload |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
56 (defvar rlogin-password-paranoia nil |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
57 "*If non-`nil', query user for a password in the minibuffer when a Password: prompt appears. |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
58 It's also possible to selectively enter passwords without echoing them in |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
59 the minibuffer using the command `rlogin-password' explicitly.") |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
60 |
2231 | 61 ;; Initialize rlogin mode map. |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
62 ;;;###autoload |
2231 | 63 (defvar rlogin-mode-map '()) |
64 (cond ((not rlogin-mode-map) | |
4678
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
65 (setq rlogin-mode-map (cons 'keymap shell-mode-map)) |
2231 | 66 (define-key rlogin-mode-map "\C-c\C-c" 'rlogin-send-Ctrl-C) |
67 (define-key rlogin-mode-map "\C-c\C-z" 'rlogin-send-Ctrl-Z) | |
68 (define-key rlogin-mode-map "\C-c\C-\\" 'rlogin-send-Ctrl-backslash) | |
69 (define-key rlogin-mode-map "\C-d" 'rlogin-delchar-or-send-Ctrl-D))) | |
70 | |
2387
cb44857cab89
moby rlogin-filter fixes
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
71 ;;;###autoload |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
72 (defun rlogin (&optional prefix host) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
73 "Open a network login connection to HOST via the `rlogin' program. |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
74 Input is sent line-at-a-time to the remote connection. |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
75 |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
76 Communication with HOST is recorded in a buffer *rlogin-HOST*. |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
77 If a prefix argument is given and the buffer *rlogin-HOST* already exists, |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
78 a new buffer with a different connection will be made. |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
79 |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
80 The variable `rlogin-program' contains the name of the actual program to |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
81 run. It can be a relative or absolute path. |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
82 |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
83 The variable `rlogin-explicit-args' is a list of arguments to give to |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
84 the rlogin when starting." |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
85 (interactive (list current-prefix-arg |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
86 (read-from-minibuffer "Open rlogin connection to host: "))) |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
87 (let* ((process-connection-type rlogin-process-connection-type) |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
88 (buffer-name (format "*rlogin-%s*" host)) |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
89 (args (if (and rlogin-explicit-args (listp rlogin-explicit-args)) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
90 (cons host rlogin-explicit-args) |
2405
f51bd6676409
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2404
diff
changeset
|
91 (list host))) |
f51bd6676409
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2404
diff
changeset
|
92 proc) |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
93 (and prefix (setq buffer-name |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
94 (buffer-name (generate-new-buffer buffer-name)))) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
95 (switch-to-buffer buffer-name) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
96 (or (comint-check-proc buffer-name) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
97 (progn |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
98 (comint-mode) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
99 (comint-exec (current-buffer) buffer-name rlogin-program nil args) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
100 (setq proc (get-process buffer-name)) |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
101 ;; Set process-mark to point-max in case there is text in the |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
102 ;; buffer from a previous exited process. |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
103 (set-marker (process-mark proc) (point-max)) |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
104 (set-process-filter proc 'rlogin-filter) |
4678
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
105 (rlogin-mode) |
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
106 ;; Set the prefix for filename completion and directory tracking |
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
107 ;; to find the remote machine's files by ftp. |
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
108 (set (make-local-variable 'comint-filename-prefix) |
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
109 (concat "/" host ":")) |
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
110 ;; Presume the user will start in his remote home directory. |
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
111 ;; If this is wrong, M-x dirs will fix it. |
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
112 (cd-absolute (concat "/" host ":~/")) |
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
113 )))) |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
114 |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
115 ;;;###autoload |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
116 (defun rlogin-with-args (host args) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
117 "Open a new rlogin connection to HOST, even if one already exists. |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
118 String ARGS is given as arguments to the `rlogin' program, overriding the |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
119 value of `rlogin-explicit-args'." |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
120 (interactive (list (read-from-minibuffer "Open rlogin connection to host: ") |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
121 (read-from-minibuffer "with arguments: "))) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
122 (let ((old-match-data (match-data)) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
123 (rlogin-explicit-args nil)) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
124 (unwind-protect |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
125 (progn |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
126 (while (string-match "[ \t]*\\([^ \t]+\\)$" args) |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
127 (setq rlogin-explicit-args |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
128 (cons (substring args |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
129 (match-beginning 1) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
130 (match-end 1)) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
131 rlogin-explicit-args) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
132 args (substring args 0 (match-beginning 0))))) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
133 (store-match-data old-match-data)) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
134 (rlogin 1 host))) |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
135 |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
136 ;;;###autoload |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
137 (defun rlogin-password (&optional proc) |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
138 "Read a password and send it to an rlogin session. |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
139 For each character typed, a `*' is echoed in the minibuffer. |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
140 End with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
141 C-g aborts attempt to read and send password. |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
142 |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
143 Optional argument PROC is the process to which the password should be sent. |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
144 If not provided, send to the process in the current buffer. This argument |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
145 is intended primarily for use by `rlogin-filter'." |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
146 (interactive) |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
147 (or proc (setq proc (get-buffer-process (current-buffer)))) |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
148 (let* ((buffer-name (buffer-name (process-buffer proc))) |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
149 (pass (comint-read-noecho (format "Password for buffer \"%s\": " |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
150 buffer-name) |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
151 'stars))) |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
152 (and pass |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
153 (save-excursion |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
154 (set-buffer buffer-name) |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
155 (insert-before-markers "\n") |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
156 (comint-send-string proc (format "%s\n" pass)))))) |
2231 | 157 |
2387
cb44857cab89
moby rlogin-filter fixes
Noah Friedman <friedman@splode.com>
parents:
2315
diff
changeset
|
158 ;;;###autoload |
2231 | 159 (defun rlogin-mode () |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
160 "Set major-mode for rlogin sessions. |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
161 If `rlogin-mode-hook' is set, run it." |
2231 | 162 (interactive) |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
163 (kill-all-local-variables) |
4678
cd842296bebf
(rlogin): After rlogin-mode, set comint-filename-prefix locally to indicate
Roland McGrath <roland@gnu.org>
parents:
2948
diff
changeset
|
164 (shell-mode) |
2231 | 165 (setq major-mode 'rlogin-mode) |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
166 (setq mode-name "rlogin") |
2231 | 167 (use-local-map rlogin-mode-map) |
168 (run-hooks 'rlogin-mode-hook)) | |
169 | |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
170 |
2231 | 171 (defun rlogin-filter (proc string) |
2948
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
172 (let (proc-mark region-begin window) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
173 (save-excursion |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
174 (set-buffer (process-buffer proc)) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
175 (setq proc-mark (process-mark proc) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
176 region-begin (point) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
177 ;; If process mark is at window start, insert-before-markers |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
178 ;; will insert text off-window since it's also inserting before |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
179 ;; the start window mark. Make sure we can see the most recent |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
180 ;; text. (note: it's a buglet that this isn't necessary if |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
181 ;; scroll-step is 0, but that works to our advantage since it |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
182 ;; makes the filter a little faster.) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
183 window (and (/= 0 scroll-step) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
184 (= proc-mark (window-start)) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
185 (get-buffer-window (current-buffer)))) |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
186 (goto-char proc-mark) |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
187 (insert-before-markers string) |
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
188 (goto-char region-begin) |
2948
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
189 ;; I think something fishy is going on with save-excursion and |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
190 ;; search-forward. If you don't make search-forward move to the end |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
191 ;; of the search region when it's done, then if the user switches |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
192 ;; buffers back and forth, it leaves point sitting behind the |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
193 ;; process-mark, so that text inserted later goes off-screen. |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
194 (while (search-forward "\C-m" proc-mark 'goto-end) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
195 (delete-char -1))) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
196 ;; Frob window-start outside of save-excursion so it works whether the |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
197 ;; current buffer is the process buffer or not. |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
198 (and window |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
199 (>= (window-start window) region-begin) |
843c652ebcc3
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2539
diff
changeset
|
200 (set-window-start window region-begin 'noforce))) |
2404
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
201 (and rlogin-password-paranoia |
845db675b3e9
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2387
diff
changeset
|
202 (string= "Password:" string) |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
203 (rlogin-password proc))) |
2231 | 204 |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
205 ;;;###autoload |
2231 | 206 (defun rlogin-send-Ctrl-C () |
207 (interactive) | |
208 (send-string nil "\C-c")) | |
209 | |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
210 ;;;###autoload |
2231 | 211 (defun rlogin-send-Ctrl-Z () |
212 (interactive) | |
213 (send-string nil "\C-z")) | |
214 | |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
215 ;;;###autoload |
2231 | 216 (defun rlogin-send-Ctrl-backslash () |
217 (interactive) | |
218 (send-string nil "\C-\\")) | |
219 | |
2539
577c77cfd199
*** empty log message ***
Noah Friedman <friedman@splode.com>
parents:
2405
diff
changeset
|
220 ;;;###autoload |
2231 | 221 (defun rlogin-delchar-or-send-Ctrl-D (arg) |
222 "Delete ARG characters forward, or send a C-d to process if at end of | |
223 buffer." | |
224 (interactive "p") | |
225 (if (eobp) | |
226 (send-string nil "\C-d") | |
227 (delete-char arg))) | |
228 | |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2231
diff
changeset
|
229 ;;; rlogin.el ends here |