3042 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
3043 |
(let ((output-buf (get-buffer-create "*tramp output*")) |
(let ((output-buf (get-buffer-create "*tramp output*")) |
3044 |
(tramp-buf (tramp-get-buffer multi-method method user host)) |
(tramp-buf (tramp-get-buffer multi-method method user host)) |
3045 |
(copy-program (tramp-get-copy-program |
(copy-program (tramp-get-method-parameter |
3046 |
multi-method |
multi-method |
3047 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
3048 |
user host)) |
user host 'tramp-copy-program)) |
3049 |
(copy-args (tramp-get-copy-args |
(copy-args (tramp-get-method-parameter |
3050 |
multi-method |
multi-method |
3051 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
3052 |
user host)) |
user host 'tramp-copy-args)) |
3053 |
;; We used to bind the following as late as possible. |
;; We used to bind the following as late as possible. |
3054 |
;; loc-enc and loc-dec were bound directly before the if |
;; loc-enc and loc-dec were bound directly before the if |
3055 |
;; statement that checks them. But the functions |
;; statement that checks them. But the functions |
3224 |
(error "File not overwritten"))) |
(error "File not overwritten"))) |
3225 |
(with-parsed-tramp-file-name filename nil |
(with-parsed-tramp-file-name filename nil |
3226 |
(let ((curbuf (current-buffer)) |
(let ((curbuf (current-buffer)) |
3227 |
(copy-program (tramp-get-copy-program |
(copy-program (tramp-get-method-parameter |
3228 |
multi-method |
multi-method |
3229 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
3230 |
user host)) |
user host 'tramp-copy-program)) |
3231 |
(copy-args (tramp-get-copy-args |
(copy-args (tramp-get-method-parameter |
3232 |
multi-method |
multi-method |
3233 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
3234 |
user host)) |
user host 'tramp-copy-args)) |
3235 |
(rem-enc (tramp-get-remote-encoding multi-method method user host)) |
(rem-enc (tramp-get-remote-encoding multi-method method user host)) |
3236 |
(rem-dec (tramp-get-remote-decoding multi-method method user host)) |
(rem-dec (tramp-get-remote-decoding multi-method method user host)) |
3237 |
(loc-enc (tramp-get-local-encoding multi-method method user host)) |
(loc-enc (tramp-get-local-encoding multi-method method user host)) |
4414 |
9 "Setting remote shell prompt...done") |
9 "Setting remote shell prompt...done") |
4415 |
) |
) |
4416 |
(t (tramp-message 5 "Remote `%s' groks tilde expansion, good" |
(t (tramp-message 5 "Remote `%s' groks tilde expansion, good" |
4417 |
(tramp-get-remote-sh multi-method method user host)))))) |
(tramp-get-method-parameter |
4418 |
|
multi-method method user host 'tramp-remote-sh)))))) |
4419 |
|
|
4420 |
(defun tramp-check-ls-command (multi-method method user host cmd) |
(defun tramp-check-ls-command (multi-method method user host cmd) |
4421 |
"Checks whether the given `ls' executable groks `-n'. |
"Checks whether the given `ls' executable groks `-n'. |
4699 |
(p (apply 'start-process |
(p (apply 'start-process |
4700 |
(tramp-buffer-name multi-method method user host) |
(tramp-buffer-name multi-method method user host) |
4701 |
(tramp-get-buffer multi-method method user host) |
(tramp-get-buffer multi-method method user host) |
4702 |
(tramp-get-login-program |
(tramp-get-method-parameter |
4703 |
multi-method |
multi-method |
4704 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4705 |
user host) |
user host 'tramp-login-program) |
4706 |
host |
host |
4707 |
(tramp-get-login-args |
(tramp-get-method-parameter |
4708 |
multi-method |
multi-method |
4709 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4710 |
user host))) |
user host 'tramp-login-args))) |
4711 |
(found nil) |
(found nil) |
4712 |
(pw nil)) |
(pw nil)) |
4713 |
(process-kill-without-query p) |
(process-kill-without-query p) |
4756 |
(let ((process-environment (copy-sequence process-environment)) |
(let ((process-environment (copy-sequence process-environment)) |
4757 |
(bufnam (tramp-buffer-name multi-method method user host)) |
(bufnam (tramp-buffer-name multi-method method user host)) |
4758 |
(buf (tramp-get-buffer multi-method method user host)) |
(buf (tramp-get-buffer multi-method method user host)) |
4759 |
(login-program (tramp-get-login-program |
(login-program (tramp-get-method-parameter |
4760 |
multi-method |
multi-method |
4761 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4762 |
user host)) |
user host 'tramp-login-program)) |
4763 |
(login-args (tramp-get-login-args |
(login-args (tramp-get-method-parameter |
4764 |
multi-method |
multi-method |
4765 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4766 |
user host))) |
user host 'tramp-login-args))) |
4767 |
;; The following should be changed. We need a more general |
;; The following should be changed. We need a more general |
4768 |
;; mechanism to parse extra host args. |
;; mechanism to parse extra host args. |
4769 |
(when (string-match "\\([^#]*\\)#\\(.*\\)" host) |
(when (string-match "\\([^#]*\\)#\\(.*\\)" host) |
4831 |
(p (apply 'start-process |
(p (apply 'start-process |
4832 |
(tramp-buffer-name multi-method method user host) |
(tramp-buffer-name multi-method method user host) |
4833 |
(tramp-get-buffer multi-method method user host) |
(tramp-get-buffer multi-method method user host) |
4834 |
(tramp-get-login-program |
(tramp-get-method-parameter |
4835 |
multi-method |
multi-method |
4836 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4837 |
user host) |
user host 'tramp-login-program) |
4838 |
(mapcar |
(mapcar |
4839 |
(lambda (x) |
(lambda (x) |
4840 |
(format-spec x `((?u . ,(or user "root"))))) |
(format-spec x `((?u . ,(or user "root"))))) |
4841 |
(tramp-get-login-args |
(tramp-get-method-parameter |
4842 |
multi-method |
multi-method |
4843 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
4844 |
user host)))) |
user host 'tramp-login-args)))) |
4845 |
(found nil) |
(found nil) |
4846 |
(pw nil)) |
(pw nil)) |
4847 |
(process-kill-without-query p) |
(process-kill-without-query p) |
5067 |
(erase-buffer) |
(erase-buffer) |
5068 |
(process-send-string |
(process-send-string |
5069 |
p (concat pw |
p (concat pw |
5070 |
(tramp-get-password-end-of-line |
(or (tramp-get-method-parameter |
5071 |
tramp-current-multi-method |
tramp-current-multi-method |
5072 |
tramp-current-method |
tramp-current-method |
5073 |
tramp-current-user |
tramp-current-user |
5074 |
tramp-current-host))))) |
tramp-current-host |
5075 |
|
'tramp-password-end-of-line) |
5076 |
|
tramp-default-password-end-of-line))))) |
5077 |
|
|
5078 |
;; HHH: Not Changed. This might handle the case where USER is not |
;; HHH: Not Changed. This might handle the case where USER is not |
5079 |
;; given in the "File name" very poorly. Then, the local |
;; given in the "File name" very poorly. Then, the local |
5116 |
(tramp-send-command-internal |
(tramp-send-command-internal |
5117 |
multi-method method user host |
multi-method method user host |
5118 |
(format "exec env 'ENV=' 'PS1=$ ' %s" |
(format "exec env 'ENV=' 'PS1=$ ' %s" |
5119 |
(tramp-get-remote-sh multi-method method user host)) |
(tramp-get-method-parameter |
5120 |
|
multi-method method user host 'tramp-remote-sh)) |
5121 |
(format "remote `%s' to come up" |
(format "remote `%s' to come up" |
5122 |
(tramp-get-remote-sh multi-method method user host))) |
(tramp-get-method-parameter |
5123 |
|
multi-method method user host 'tramp-remote-sh))) |
5124 |
(tramp-barf-if-no-shell-prompt |
(tramp-barf-if-no-shell-prompt |
5125 |
p 30 |
p 30 |
5126 |
"Remote `%s' didn't come up. See buffer `%s' for details" |
"Remote `%s' didn't come up. See buffer `%s' for details" |
5127 |
(tramp-get-remote-sh multi-method method user host) |
(tramp-get-method-parameter multi-method method user host 'tramp-remote-sh) |
5128 |
(buffer-name)) |
(buffer-name)) |
5129 |
(tramp-message 8 "Setting up remote shell environment") |
(tramp-message 8 "Setting up remote shell environment") |
5130 |
(tramp-discard-garbage-erase-buffer p multi-method method user host) |
(tramp-discard-garbage-erase-buffer p multi-method method user host) |
5307 |
" -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" |
" -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" |
5308 |
"}")) |
"}")) |
5309 |
(tramp-wait-for-output) |
(tramp-wait-for-output) |
5310 |
(unless (tramp-get-copy-program |
(unless (tramp-get-method-parameter |
5311 |
multi-method |
multi-method |
5312 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
5313 |
user host) |
user host 'tramp-copy-program) |
5314 |
(tramp-message 5 "Sending the Perl `mime-encode' implementations.") |
(tramp-message 5 "Sending the Perl `mime-encode' implementations.") |
5315 |
(tramp-send-string |
(tramp-send-string |
5316 |
multi-method method user host |
multi-method method user host |
5349 |
(tramp-set-connection-property "ln" ln multi-method method user host))) |
(tramp-set-connection-property "ln" ln multi-method method user host))) |
5350 |
(erase-buffer) |
(erase-buffer) |
5351 |
;; Find the right encoding/decoding commands to use. |
;; Find the right encoding/decoding commands to use. |
5352 |
(unless (tramp-get-copy-program |
(unless (tramp-get-method-parameter |
5353 |
multi-method |
multi-method |
5354 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
5355 |
user host) |
user host 'tramp-copy-program) |
5356 |
(tramp-find-inline-encoding multi-method method user host)) |
(tramp-find-inline-encoding multi-method method user host)) |
5357 |
;; If encoding/decoding command are given, test to see if they work. |
;; If encoding/decoding command are given, test to see if they work. |
5358 |
;; CCC: Maybe it would be useful to run the encoder both locally and |
;; CCC: Maybe it would be useful to run the encoder both locally and |
5565 |
(unless (and p (processp p) (memq (process-status p) '(run open))) |
(unless (and p (processp p) (memq (process-status p) '(run open))) |
5566 |
(when (and p (processp p)) |
(when (and p (processp p)) |
5567 |
(delete-process p)) |
(delete-process p)) |
5568 |
(funcall (tramp-get-connection-function |
(funcall (tramp-get-method-parameter |
5569 |
multi-method |
multi-method |
5570 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
5571 |
user host) |
user host 'tramp-connection-function) |
5572 |
multi-method method user host)))) |
multi-method method user host)))) |
5573 |
|
|
5574 |
(defun tramp-send-command |
(defun tramp-send-command |
6052 |
"Return t if this is an out-of-band method, nil otherwise. |
"Return t if this is an out-of-band method, nil otherwise. |
6053 |
It is important to check for this condition, since it is not possible |
It is important to check for this condition, since it is not possible |
6054 |
to enter a password for the `tramp-copy-program'." |
to enter a password for the `tramp-copy-program'." |
6055 |
(tramp-get-copy-program |
(tramp-get-method-parameter |
6056 |
multi-method |
multi-method |
6057 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
6058 |
user host)) |
user host 'tramp-copy-program)) |
6059 |
|
|
6060 |
;; Variables local to connection. |
;; Variables local to connection. |
6061 |
|
|
6134 |
(tramp-get-connection-property "local-decoding" nil |
(tramp-get-connection-property "local-decoding" nil |
6135 |
multi-method method user host)) |
multi-method method user host)) |
6136 |
|
|
6137 |
|
(defun tramp-get-method-parameter (multi-method method user host param) |
6138 |
|
"Return the method parameter PARAM. |
6139 |
(defun tramp-get-connection-function (multi-method method user host) |
If the `tramp-methods' entry does not exist, use the variable PARAM |
6140 |
(second (or (assoc 'tramp-connection-function |
as default." |
6141 |
(assoc (tramp-find-method multi-method method user host) |
(unless (boundp param) |
6142 |
tramp-methods)) |
(error "Non-existing method parameter `%s'" param)) |
6143 |
(error "Method `%s' didn't specify a connection function" |
(let ((entry (assoc param |
|
(or multi-method method))))) |
|
|
|
|
|
(defun tramp-get-remote-sh (multi-method method user host) |
|
|
(second (or (assoc 'tramp-remote-sh |
|
|
(assoc (tramp-find-method multi-method method user host) |
|
|
tramp-methods)) |
|
|
(error "Method `%s' didn't specify a remote shell" |
|
|
(or multi-method method))))) |
|
|
|
|
|
(defun tramp-get-login-program (multi-method method user host) |
|
|
(second (or (assoc 'tramp-login-program |
|
|
(assoc (tramp-find-method multi-method method user host) |
|
|
tramp-methods)) |
|
|
(error "Method `%s' didn't specify a login program" |
|
|
(or multi-method method))))) |
|
|
|
|
|
(defun tramp-get-login-args (multi-method method user host) |
|
|
(second (or (assoc 'tramp-login-args |
|
|
(assoc (tramp-find-method multi-method method user host) |
|
|
tramp-methods)) |
|
|
(error "Method `%s' didn't specify login args" |
|
|
(or multi-method method))))) |
|
|
|
|
|
(defun tramp-get-copy-program (multi-method method user host) |
|
|
(second (or (assoc 'tramp-copy-program |
|
|
(assoc (tramp-find-method multi-method method user host) |
|
|
tramp-methods)) |
|
|
(error "Method `%s' didn't specify a copy program" |
|
|
(or multi-method method))))) |
|
|
|
|
|
(defun tramp-get-copy-args (multi-method method user host) |
|
|
(second (or (assoc 'tramp-copy-args |
|
|
(assoc (tramp-find-method multi-method method user host) |
|
|
tramp-methods)) |
|
|
(error "Method `%s' didn't specify copy args" |
|
|
(or multi-method method))))) |
|
|
|
|
|
(defun tramp-get-copy-keep-date-arg (multi-method method user host) |
|
|
(second (or (assoc 'tramp-copy-keep-date-arg |
|
|
(assoc (tramp-find-method multi-method method user host) |
|
|
tramp-methods)) |
|
|
(error "Method `%s' didn't specify `keep-date' arg for tramp" |
|
|
(or multi-method method))))) |
|
|
|
|
|
(defun tramp-get-password-end-of-line (multi-method method user host) |
|
|
(let ((entry (assoc 'tramp-password-end-of-line |
|
6144 |
(assoc (tramp-find-method multi-method method user host) |
(assoc (tramp-find-method multi-method method user host) |
6145 |
tramp-methods)))) |
tramp-methods)))) |
6146 |
(unless entry |
(if entry |
6147 |
(error "Method `%s' didn't specify `password-end-of-line' arg for tramp" |
(second entry) |
6148 |
(or multi-method method))) |
(symbol-value param)))) |
6149 |
(or (second entry) tramp-default-password-end-of-line))) |
|
6150 |
|
|
6151 |
;; Auto saving to a special directory. |
;; Auto saving to a special directory. |
6152 |
|
|
6476 |
|
|
6477 |
;;; TODO: |
;;; TODO: |
6478 |
|
|
6479 |
|
;; * tramp-copy-keep-date-arg is not used! |
6480 |
;; * Allow putting passwords in the filename. |
;; * Allow putting passwords in the filename. |
6481 |
;; This should be implemented via a general mechanism to add |
;; This should be implemented via a general mechanism to add |
6482 |
;; parameters in filenames. There is currently a kludge for |
;; parameters in filenames. There is currently a kludge for |