Function: tramp-find-inline-compress
tramp-find-inline-compress is a byte-compiled function defined in
tramp-sh.el.gz.
Signature
(tramp-find-inline-compress VEC)
Documentation
Find an inline transfer compress command that works.
Goes through the list tramp-inline-compress-commands.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-find-inline-compress (vec)
"Find an inline transfer compress command that works.
Goes through the list `tramp-inline-compress-commands'."
(save-excursion
(let ((commands tramp-inline-compress-commands)
(magic "xyzzy")
(p (tramp-get-connection-process vec))
item compress decompress found)
(while (and commands (not found))
(catch 'next
(setq item (pop commands)
compress (nth 0 item)
decompress (nth 1 item))
(tramp-message
vec 5
"Checking local compress commands `%s', `%s' for sanity"
compress decompress)
(with-temp-buffer
(unless (zerop
(tramp-call-local-coding-command
(format
"echo %s | %s | %s" magic
;; Windows shells need the program file name
;; after the pipe symbol be quoted if they use
;; forward slashes as directory separators.
(mapconcat
#'tramp-unquote-shell-quote-argument
(split-string compress) " ")
(mapconcat
#'tramp-unquote-shell-quote-argument
(split-string decompress) " "))
nil t))
(throw 'next nil))
(goto-char (point-min))
(unless (looking-at-p (rx (literal magic)))
(throw 'next nil)))
(tramp-message
vec 5
"Checking remote compress commands `%s', `%s' for sanity"
compress decompress)
(unless (tramp-send-command-and-check
vec (format "echo %s | %s | %s" magic compress decompress) t)
(throw 'next nil))
(with-current-buffer (tramp-get-buffer vec)
(goto-char (point-min))
(unless (looking-at-p (rx (literal magic)))
(throw 'next nil)))
(setq found t)))
;; Did we find something?
(if found
(progn
;; Set connection properties. Since the commands are
;; risky (due to output direction), we cache them in the
;; process cache.
(tramp-message
vec 5 "Using inline transfer compress command `%s'" compress)
(tramp-set-connection-property p "inline-compress" compress)
(tramp-message
vec 5 "Using inline transfer decompress command `%s'" decompress)
(tramp-set-connection-property p "inline-decompress" decompress))
(tramp-set-connection-property p "inline-compress" nil)
(tramp-set-connection-property p "inline-decompress" nil)
(tramp-warning
vec "Couldn't find an inline transfer compress command")))))