1171 |
:group 'tramp |
:group 'tramp |
1172 |
:type '(repeat (list variable function))) |
:type '(repeat (list variable function))) |
1173 |
|
|
1174 |
|
(defcustom tramp-initial-commands |
1175 |
|
'("unset autocorrect") |
1176 |
|
"List of commands to send to the first remote shell that we see. |
1177 |
|
These commands will be sent to any shell, and thus they should be |
1178 |
|
designed to work in such circumstances. Also, restrict the commands |
1179 |
|
to the bare necessity for getting the remote shell into a state |
1180 |
|
where it is possible to execute the Bourne-ish shell. |
1181 |
|
|
1182 |
|
At the moment, the command to execute the Bourne-ish shell uses strange |
1183 |
|
quoting which `tcsh' tries to correct, so we send the command \"unset |
1184 |
|
autocorrect\" to the remote host." |
1185 |
|
:group 'tramp |
1186 |
|
:type '(repeat string)) |
1187 |
|
|
1188 |
;; Chunked sending kluge. We set this to 500 for black-listed constellations |
;; Chunked sending kluge. We set this to 500 for black-listed constellations |
1189 |
;; known to have a bug in `process-send-string'; some ssh connections appear |
;; known to have a bug in `process-send-string'; some ssh connections appear |
1190 |
;; to drop bytes when data is sent too quickly. |
;; to drop bytes when data is sent too quickly. |
4129 |
|
|
4130 |
(defun tramp-buffer-name (multi-method method user host) |
(defun tramp-buffer-name (multi-method method user host) |
4131 |
"A name for the connection buffer for USER at HOST using METHOD." |
"A name for the connection buffer for USER at HOST using METHOD." |
4132 |
(cond (multi-method |
(if multi-method |
4133 |
(tramp-buffer-name-multi-method "tramp" multi-method method user host)) |
(tramp-buffer-name-multi-method "tramp" multi-method method user host) |
4134 |
(user |
(let ((method (tramp-find-method multi-method method user host))) |
4135 |
(format "*tramp/%s %s@%s*" method user host)) |
(if user |
4136 |
(t |
(format "*tramp/%s %s@%s*" method user host)) |
4137 |
(format "*tramp/%s %s*" method host)))) |
(format "*tramp/%s %s*" method host)))) |
4138 |
|
|
4139 |
(defun tramp-buffer-name-multi-method (prefix multi-method method user host) |
(defun tramp-buffer-name-multi-method (prefix multi-method method user host) |
4140 |
"A name for the multi method connection buffer. |
"A name for the multi method connection buffer. |
4164 |
|
|
4165 |
(defun tramp-debug-buffer-name (multi-method method user host) |
(defun tramp-debug-buffer-name (multi-method method user host) |
4166 |
"A name for the debug buffer for USER at HOST using METHOD." |
"A name for the debug buffer for USER at HOST using METHOD." |
4167 |
(cond (multi-method |
(if multi-method |
4168 |
(tramp-buffer-name-multi-method "debug tramp" |
(tramp-buffer-name-multi-method "debug tramp" |
4169 |
multi-method method user host)) |
multi-method method user host) |
4170 |
(user |
(let ((method (tramp-find-method multi-method method user host))) |
4171 |
(format "*debug tramp/%s %s@%s*" method user host)) |
(if user |
4172 |
(t |
(format "*debug tramp/%s %s@%s*" method user host) |
4173 |
(format "*debug tramp/%s %s*" method host)))) |
(format "*debug tramp/%s %s*" method host))))) |
4174 |
|
|
4175 |
(defun tramp-get-debug-buffer (multi-method method user host) |
(defun tramp-get-debug-buffer (multi-method method user host) |
4176 |
"Get the debug buffer for USER at HOST using METHOD." |
"Get the debug buffer for USER at HOST using METHOD." |
4554 |
(unless (eq exit 'ok) |
(unless (eq exit 'ok) |
4555 |
(error "Login failed")))) |
(error "Login failed")))) |
4556 |
|
|
4557 |
|
;; Functions to execute when we have seen the remote shell prompt but |
4558 |
|
;; before we exec the Bourne-ish shell. Note that these commands |
4559 |
|
;; might be sent to any shell, not just a Bourne-ish shell. This |
4560 |
|
;; means that the commands need to work in all shells. (It is also |
4561 |
|
;; okay for some commands to just fail with an error message, but |
4562 |
|
;; please make sure that they at least don't crash the odd shell people |
4563 |
|
;; might be running...) |
4564 |
|
(defun tramp-process-initial-commands (p |
4565 |
|
multi-method method user host |
4566 |
|
commands) |
4567 |
|
"Send list of commands to remote host, in order." |
4568 |
|
(let (cmd) |
4569 |
|
(while commands |
4570 |
|
(setq cmd (pop commands)) |
4571 |
|
(erase-buffer) |
4572 |
|
(tramp-message 10 "Sending command to remote shell: %s" |
4573 |
|
cmd) |
4574 |
|
(tramp-send-command multi-method method user host cmd) |
4575 |
|
(tramp-barf-if-no-shell-prompt |
4576 |
|
p 60 "Remote shell command failed: %s" cmd)) |
4577 |
|
(erase-buffer))) |
4578 |
|
|
4579 |
;; The actual functions for opening connections. |
;; The actual functions for opening connections. |
4580 |
|
|
4581 |
(defun tramp-open-connection-telnet (multi-method method user host) |
(defun tramp-open-connection-telnet (multi-method method user host) |
5012 |
;; a Kerberos login. |
;; a Kerberos login. |
5013 |
(sit-for 1) |
(sit-for 1) |
5014 |
(tramp-discard-garbage-erase-buffer p multi-method method user host) |
(tramp-discard-garbage-erase-buffer p multi-method method user host) |
5015 |
|
(tramp-process-initial-commands p multi-method method user host |
5016 |
|
tramp-initial-commands) |
5017 |
;; It is useful to set the prompt in the following command because |
;; It is useful to set the prompt in the following command because |
5018 |
;; some people have a setting for $PS1 which /bin/sh doesn't know |
;; some people have a setting for $PS1 which /bin/sh doesn't know |
5019 |
;; about and thus /bin/sh will display a strange prompt. For |
;; about and thus /bin/sh will display a strange prompt. For |