Function: rlogin
rlogin is an autoloaded, interactive and byte-compiled function
defined in rlogin.el.gz.
Signature
(rlogin INPUT-ARGS &optional BUFFER)
Documentation
Open a network login connection via rlogin with args INPUT-ARGS.
INPUT-ARGS should start with a host name; it may also contain
other arguments for rlogin.
Input is sent line-at-a-time to the remote connection.
Communication with the remote host is recorded in a buffer *rlogin-HOST*
(or *rlogin-USER@HOST* if the remote username differs).
If a prefix argument is given and the buffer *rlogin-HOST* already exists,
a new buffer with a different connection will be made.
When called from a program, if the optional second argument BUFFER is a string or buffer, it specifies the buffer to use.
The variable rlogin-program contains the name of the actual program to
run. It can be a relative or absolute path.
The variable rlogin-explicit-args is a list of arguments to give to
the rlogin when starting. They are added after any arguments given in
INPUT-ARGS.
If the default value of rlogin-directory-tracking-mode(var)/rlogin-directory-tracking-mode(fun) is t, then the
default directory in that buffer is set to a remote (FTP) file name to
access your home directory on the remote machine. Occasionally this causes
an error, if you cannot access the home directory on that machine. This
error is harmless as long as you don't try to use that default directory.
If rlogin-directory-tracking-mode(var)/rlogin-directory-tracking-mode(fun) is neither t nor nil, then the default
directory is initially set up to your (local) home directory.
This is useful if the remote machine and your local machine
share the same files via NFS. This is the default.
If you wish to change directory tracking styles during a session, use the
function rlogin-directory-tracking-mode(var)/rlogin-directory-tracking-mode(fun) rather than simply setting the
variable.
Probably introduced at or before Emacs version 15.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/net/rlogin.el.gz
;;;###autoload
(defun rlogin (input-args &optional buffer)
"Open a network login connection via `rlogin' with args INPUT-ARGS.
INPUT-ARGS should start with a host name; it may also contain
other arguments for `rlogin'.
Input is sent line-at-a-time to the remote connection.
Communication with the remote host is recorded in a buffer `*rlogin-HOST*'
\(or `*rlogin-USER@HOST*' if the remote username differs).
If a prefix argument is given and the buffer `*rlogin-HOST*' already exists,
a new buffer with a different connection will be made.
When called from a program, if the optional second argument BUFFER is
a string or buffer, it specifies the buffer to use.
The variable `rlogin-program' contains the name of the actual program to
run. It can be a relative or absolute path.
The variable `rlogin-explicit-args' is a list of arguments to give to
the rlogin when starting. They are added after any arguments given in
INPUT-ARGS.
If the default value of `rlogin-directory-tracking-mode' is t, then the
default directory in that buffer is set to a remote (FTP) file name to
access your home directory on the remote machine. Occasionally this causes
an error, if you cannot access the home directory on that machine. This
error is harmless as long as you don't try to use that default directory.
If `rlogin-directory-tracking-mode' is neither t nor nil, then the default
directory is initially set up to your (local) home directory.
This is useful if the remote machine and your local machine
share the same files via NFS. This is the default.
If you wish to change directory tracking styles during a session, use the
function `rlogin-directory-tracking-mode' rather than simply setting the
variable."
(interactive (list
(read-from-minibuffer (format-message
"Arguments for `%s' (hostname first): "
(file-name-nondirectory rlogin-program))
nil nil nil 'rlogin-history)
current-prefix-arg))
(let* ((process-connection-type rlogin-process-connection-type)
(args (if rlogin-explicit-args
(append (split-string input-args)
rlogin-explicit-args)
(split-string input-args)))
(host (let ((tail args))
;; Find first arg that doesn't look like an option.
;; This still loses for args that take values, feh.
(while (and tail (= ?- (aref (car tail) 0)))
(setq tail (cdr tail)))
(car tail)))
(user (or (car (cdr (member "-l" args)))
(user-login-name)))
(buffer-name (if (string= user (user-login-name))
(format "*rlogin-%s*" host)
(format "*rlogin-%s@%s*" user host))))
(cond ((null buffer))
((stringp buffer)
(setq buffer-name buffer))
((bufferp buffer)
(setq buffer-name (buffer-name buffer)))
((numberp buffer)
(setq buffer-name (format "%s<%d>" buffer-name buffer)))
(t
(setq buffer-name (generate-new-buffer-name buffer-name))))
(setq buffer (get-buffer-create buffer-name))
(switch-to-buffer buffer-name)
(unless (comint-check-proc buffer-name)
(comint-exec buffer buffer-name rlogin-program nil args)
(rlogin-mode)
(setq-local rlogin-host host)
(setq-local rlogin-remote-user user)
(ignore-errors
(cond ((eq rlogin-directory-tracking-mode t)
;; Do this here, rather than calling the tracking mode
;; function, to avoid a gratuitous resync check; the default
;; should be the user's home directory, be it local or remote.
(setq comint-file-name-prefix
(concat "/-:" rlogin-remote-user "@" rlogin-host ":"))
(cd-absolute comint-file-name-prefix))
((null rlogin-directory-tracking-mode))
(t
(cd-absolute (concat comint-file-name-prefix "~/"))))))))