Function: tramp-scp-force-scp-protocol

tramp-scp-force-scp-protocol is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-scp-force-scp-protocol VEC)

Documentation

Return the force scp protocol argument of the local scp.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-scp-force-scp-protocol (vec)
  "Return the force scp protocol argument of the local scp."
  (cond
   ;; No options to be computed.
   ((null (assoc "%y" (tramp-get-method-parameter vec 'tramp-copy-args)))
    "")

   ;; There is already a value to be used.
   ((stringp tramp-scp-force-scp-protocol)
    tramp-scp-force-scp-protocol)

   ;; Determine the options.
   (t (setq tramp-scp-force-scp-protocol "")
      (let ((case-fold-search t))
	(ignore-errors
	  (when (executable-find "scp")
	    (with-tramp-progress-reporter
		vec 4 "Computing force scp protocol argument"
	      (with-temp-buffer
		(tramp-call-process vec "scp" nil t nil "-O")
		(goto-char (point-min))
		(unless
                    (search-forward-regexp
                     (rx (| "illegal" "unknown") " option -- O") nil t)
		  (setq tramp-scp-force-scp-protocol "-O")))))))
      tramp-scp-force-scp-protocol)))