3288 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
3289 |
multi-method method user host |
multi-method method user host |
3290 |
6 "Sending data to remote host...") |
6 "Sending data to remote host...") |
3291 |
(tramp-send-region multi-method method user host |
(tramp-send-string multi-method method user host |
3292 |
(point-min) (point-max)) |
(buffer-string)) |
3293 |
;; wait for remote decoding to complete |
;; wait for remote decoding to complete |
3294 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
3295 |
multi-method method user host |
multi-method method user host |
5196 |
(tramp-wait-for-output) |
(tramp-wait-for-output) |
5197 |
;; Send the fallback `uudecode' script. |
;; Send the fallback `uudecode' script. |
5198 |
(erase-buffer) |
(erase-buffer) |
5199 |
(tramp-send-linewise multi-method method user host tramp-uudecode) |
(tramp-send-string multi-method method user host tramp-uudecode) |
5200 |
(tramp-wait-for-output) |
(tramp-wait-for-output) |
5201 |
;; Find a `perl'. |
;; Find a `perl'. |
5202 |
(erase-buffer) |
(erase-buffer) |
5211 |
;; Set up stat in Perl if we can. |
;; Set up stat in Perl if we can. |
5212 |
(when tramp-remote-perl |
(when tramp-remote-perl |
5213 |
(tramp-message 5 "Sending the Perl `file-attributes' implementation.") |
(tramp-message 5 "Sending the Perl `file-attributes' implementation.") |
5214 |
(tramp-send-linewise |
(tramp-send-string |
5215 |
multi-method method user host |
multi-method method user host |
5216 |
(concat "tramp_file_attributes () {\n" |
(concat "tramp_file_attributes () {\n" |
5217 |
tramp-remote-perl |
tramp-remote-perl |
5223 |
(tramp-find-method multi-method method user host) |
(tramp-find-method multi-method method user host) |
5224 |
user host) |
user host) |
5225 |
(tramp-message 5 "Sending the Perl `mime-encode' implementations.") |
(tramp-message 5 "Sending the Perl `mime-encode' implementations.") |
5226 |
(tramp-send-linewise |
(tramp-send-string |
5227 |
multi-method method user host |
multi-method method user host |
5228 |
(concat "tramp_encode () {\n" |
(concat "tramp_encode () {\n" |
5229 |
(format tramp-perl-encode tramp-remote-perl) |
(format tramp-perl-encode tramp-remote-perl) |
5230 |
" 2>/dev/null" |
" 2>/dev/null" |
5231 |
"\n}")) |
"\n}")) |
5232 |
(tramp-wait-for-output) |
(tramp-wait-for-output) |
5233 |
(tramp-send-linewise |
(tramp-send-string |
5234 |
multi-method method user host |
multi-method method user host |
5235 |
(concat "tramp_encode_with_module () {\n" |
(concat "tramp_encode_with_module () {\n" |
5236 |
(format tramp-perl-encode-with-module tramp-remote-perl) |
(format tramp-perl-encode-with-module tramp-remote-perl) |
5238 |
"\n}")) |
"\n}")) |
5239 |
(tramp-wait-for-output) |
(tramp-wait-for-output) |
5240 |
(tramp-message 5 "Sending the Perl `mime-decode' implementations.") |
(tramp-message 5 "Sending the Perl `mime-decode' implementations.") |
5241 |
(tramp-send-linewise |
(tramp-send-string |
5242 |
multi-method method user host |
multi-method method user host |
5243 |
(concat "tramp_decode () {\n" |
(concat "tramp_decode () {\n" |
5244 |
(format tramp-perl-decode tramp-remote-perl) |
(format tramp-perl-decode tramp-remote-perl) |
5245 |
" 2>/dev/null" |
" 2>/dev/null" |
5246 |
"\n}")) |
"\n}")) |
5247 |
(tramp-wait-for-output) |
(tramp-wait-for-output) |
5248 |
(tramp-send-linewise |
(tramp-send-string |
5249 |
multi-method method user host |
multi-method method user host |
5250 |
(concat "tramp_decode_with_module () {\n" |
(concat "tramp_decode_with_module () {\n" |
5251 |
(format tramp-perl-decode-with-module tramp-remote-perl) |
(format tramp-perl-decode-with-module tramp-remote-perl) |
5505 |
(process-send-string proc |
(process-send-string proc |
5506 |
(concat command tramp-rsh-end-of-line)))) |
(concat command tramp-rsh-end-of-line)))) |
5507 |
|
|
|
;; It seems that Tru64 Unix does not like it if long strings are sent |
|
|
;; to it in one go. (This happens when sending the Perl |
|
|
;; `file-attributes' implementation, for instance.) Therefore, we |
|
|
;; have this function which waits a bit at each line. |
|
|
(defun tramp-send-linewise |
|
|
(multi-method method user host string &optional noerase) |
|
|
"Send the STRING to USER at HOST linewise. |
|
|
Erases temporary buffer before sending the STRING (unless NOERASE |
|
|
is true). |
|
|
|
|
|
The STRING is expected to use Unix line-endings, but the lines sent to |
|
|
the remote host use line-endings as defined in the variable |
|
|
`tramp-rsh-end-of-line'." |
|
|
(tramp-maybe-open-connection multi-method method user host) |
|
|
(when tramp-debug-buffer |
|
|
(save-excursion |
|
|
(set-buffer (tramp-get-debug-buffer multi-method method user host)) |
|
|
(goto-char (point-max)) |
|
|
(tramp-insert-with-face 'bold (format "$ %s\n" string)))) |
|
|
(let ((proc nil) |
|
|
(lines (split-string string "\n"))) |
|
|
(set-buffer (tramp-get-buffer multi-method method user host)) |
|
|
(unless noerase (erase-buffer)) |
|
|
(setq proc (get-buffer-process (current-buffer))) |
|
|
(mapcar (lambda (x) |
|
|
(sleep-for 0.1) |
|
|
(process-send-string proc |
|
|
(concat x tramp-rsh-end-of-line))) |
|
|
lines))) |
|
|
|
|
5508 |
(defun tramp-wait-for-output (&optional timeout) |
(defun tramp-wait-for-output (&optional timeout) |
5509 |
"Wait for output from remote rsh command." |
"Wait for output from remote rsh command." |
5510 |
(let ((proc (get-buffer-process (current-buffer))) |
(let ((proc (get-buffer-process (current-buffer))) |
5609 |
(pop-to-buffer (current-buffer)) |
(pop-to-buffer (current-buffer)) |
5610 |
(funcall 'signal signal (apply 'format fmt args)))) |
(funcall 'signal signal (apply 'format fmt args)))) |
5611 |
|
|
5612 |
(defun tramp-send-region (multi-method method user host start end) |
;; It seems that Tru64 Unix does not like it if long strings are sent |
5613 |
"Send the region from START to END to remote command |
;; to it in one go. (This happens when sending the Perl |
5614 |
running as USER on HOST using METHOD." |
;; `file-attributes' implementation, for instance.) Therefore, we |
5615 |
|
;; have this function which waits a bit at each line. |
5616 |
|
(defun tramp-send-string |
5617 |
|
(multi-method method user host string) |
5618 |
|
"Send the STRING to USER at HOST using METHOD. |
5619 |
|
|
5620 |
|
The STRING is expected to use Unix line-endings, but the lines sent to |
5621 |
|
the remote host use line-endings as defined in the variable |
5622 |
|
`tramp-rsh-end-of-line'." |
5623 |
(let ((proc (get-buffer-process |
(let ((proc (get-buffer-process |
5624 |
(tramp-get-buffer multi-method method user host)))) |
(tramp-get-buffer multi-method method user host)))) |
5625 |
(unless proc |
(unless proc |
5626 |
(error "Can't send region to remote host -- not logged in")) |
(error "Can't send string to remote host -- not logged in")) |
5627 |
|
;; debug message |
5628 |
|
(when tramp-debug-buffer |
5629 |
|
(save-excursion |
5630 |
|
(set-buffer (tramp-get-debug-buffer multi-method method user host)) |
5631 |
|
(goto-char (point-max)) |
5632 |
|
(tramp-insert-with-face 'bold (format "$ %s\n" string)))) |
5633 |
|
;; replace "\n" by `tramp-rsh-end-of-line' |
5634 |
|
(setq string |
5635 |
|
(mapconcat 'identity |
5636 |
|
(split-string string "\n") |
5637 |
|
tramp-rsh-end-of-line)) |
5638 |
|
(unless (string-equal (substring string -1) tramp-rsh-end-of-line) |
5639 |
|
(setq string (concat string tramp-rsh-end-of-line))) |
5640 |
|
;; send the string |
5641 |
(if (and tramp-chunksize (not (zerop tramp-chunksize))) |
(if (and tramp-chunksize (not (zerop tramp-chunksize))) |
5642 |
(let ((pos start)) |
(let ((pos 0) |
5643 |
|
(end (length string))) |
5644 |
(while (< pos end) |
(while (< pos end) |
5645 |
(tramp-message-for-buffer |
(tramp-message-for-buffer |
5646 |
multi-method method user host 10 |
multi-method method user host 10 |
5647 |
"Sending chunk from %s to %s" |
"Sending chunk from %s to %s" |
5648 |
pos |
pos (min (+ pos tramp-chunksize) end)) |
5649 |
(min (+ pos tramp-chunksize) |
(process-send-string |
5650 |
end)) |
proc (substring string pos (min (+ pos tramp-chunksize) end))) |
|
(process-send-region proc |
|
|
pos |
|
|
(min (+ pos tramp-chunksize) |
|
|
end)) |
|
5651 |
(setq pos (+ pos tramp-chunksize)) |
(setq pos (+ pos tramp-chunksize)) |
5652 |
(sleep-for 0.1))) |
(sleep-for 0.1))) |
5653 |
(process-send-region proc start end)) |
(process-send-string proc string)))) |
|
(when tramp-debug-buffer |
|
|
(append-to-buffer |
|
|
(tramp-get-debug-buffer multi-method method user host) |
|
|
start end)))) |
|
5654 |
|
|
5655 |
(defun tramp-send-eof (multi-method method user host) |
(defun tramp-send-eof (multi-method method user host) |
5656 |
"Send EOF to the remote end. |
"Send EOF to the remote end. |