1 ;;; rlogin.el --- remote login interface
3 ;; Maintainer: Noah Friedman <friedman@prep.ai.mit.edu>
4 ;; Keywords: unix, comm
6 ;;; Copyright (C) 1992 Free Software Foundation, Inc.
8 ;;; This program is free software; you can redistribute it and/or modify
9 ;;; it under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 2, or (at your option)
11 ;;; any later version.
13 ;;; This program is distributed in the hope that it will be useful,
14 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with this program; if not, you can either send email to this
20 ;;; program's author (see below) or write to:
22 ;;; The Free Software Foundation, Inc.
23 ;;; 675 Massachusetts Avenue.
24 ;;; Cambridge, MA 02139, USA.
27 ;;; Todo: add directory tracking using ange-ftp style patchnames for the cwd.
33 (defvar rlogin-program
"rlogin"
34 "*Name of program to invoke rlogin")
36 (defvar rlogin-mode-hook nil
37 "*Hooks to run after setting current buffer to rlogin-mode.")
39 ;; Initialize rlogin mode map.
40 (defvar rlogin-mode-map
'())
41 (cond ((not rlogin-mode-map
)
42 (setq rlogin-mode-map
(full-copy-sparse-keymap comint-mode-map
))
43 ;(define-key rlogin-mode-map "\M-\t" 'comint-dynamic-complete)
44 ;(define-key rlogin-mode-map "\M-?" 'comint-dynamic-list-completions)
45 (define-key rlogin-mode-map
"\C-c\C-c" 'rlogin-send-Ctrl-C
)
46 (define-key rlogin-mode-map
"\C-c\C-z" 'rlogin-send-Ctrl-Z
)
47 (define-key rlogin-mode-map
"\C-c\C-\\" 'rlogin-send-Ctrl-backslash
)
48 (define-key rlogin-mode-map
"\C-d" 'rlogin-delchar-or-send-Ctrl-D
)))
51 (interactive "sOpen rlogin connection to host: ")
52 (let* ((buffer-name (concat "rlogin-" host
))
53 (*buffer-name
* (concat "*" buffer-name
"*")))
54 (cond ((not (comint-check-proc *buffer-name
*))
55 (let* ((xargs-name (intern-soft "explicit-rlogin-args"))
56 (xargs (and xargs-name
(boundp xargs-name
) (symbol-value xargs-name
)))
57 (process-connection-type nil
)
60 (setq xargs
(append xargs host
))
61 (setq xargs
(list host
)))
62 (set-buffer (apply 'make-comint buffer-name rlogin-program nil xargs
))
63 (setq proc
(get-process buffer-name
))
64 (set-process-filter proc
'rlogin-filter
)
66 (switch-to-buffer *buffer-name
*)))
71 (setq comint-prompt-regexp shell-prompt-pattern
)
72 (setq major-mode
'rlogin-mode
)
73 (setq mode-name
"Rlogin")
74 (use-local-map rlogin-mode-map
)
75 (run-hooks 'rlogin-mode-hook
))
77 (defun rlogin-filter (proc string
)
78 (let ((process-buffer (process-buffer proc
))
81 (set-buffer process-buffer
)
82 (goto-char (point-max))
86 (subst-char-in-region now
(point) ?\C-m ?\
)
87 (subst-char-in-region now
(point) ?\M-r ?\
)
88 (setq process-mark
(process-mark proc
))
90 (set-marker process-mark
(point)))))
92 (eq process-buffer
(current-buffer))
93 (goto-char (point-max)))))
95 (defun rlogin-send-Ctrl-C ()
97 (send-string nil
"\C-c"))
99 (defun rlogin-send-Ctrl-Z ()
101 (send-string nil
"\C-z"))
103 (defun rlogin-send-Ctrl-backslash ()
105 (send-string nil
"\C-\\"))
107 (defun rlogin-delchar-or-send-Ctrl-D (arg)
108 "Delete ARG characters forward, or send a C-d to process if at end of
112 (send-string nil
"\C-d")
115 ;;; rlogin.el ends here