Function: tramp-do-file-attributes-with-stat

tramp-do-file-attributes-with-stat is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-do-file-attributes-with-stat VEC LOCALNAME &optional ID-FORMAT)

Documentation

Implement file-attributes for Tramp files using stat(1) command.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-do-file-attributes-with-stat
  (vec localname &optional id-format)
  "Implement `file-attributes' for Tramp files using stat(1) command."
  (tramp-message vec 5 "file attributes with stat: %s" localname)
  (tramp-send-command-and-read
   vec
   (format
    (concat
     ;; Apostrophes in the stat output are masked as
     ;; `tramp-stat-marker', in order to make a proper shell escape of
     ;; them in file names.
     "(%s -c '((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' %s |"
     " sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g')")
    (tramp-get-remote-stat vec)
    tramp-stat-marker tramp-stat-marker
    (if (eq id-format 'integer)
	"%u"
      (eval-when-compile (concat tramp-stat-marker "%U" tramp-stat-marker)))
    (if (eq id-format 'integer)
	"%g"
      (eval-when-compile (concat tramp-stat-marker "%G" tramp-stat-marker)))
    tramp-stat-marker tramp-stat-marker
    (tramp-shell-quote-argument localname)
    tramp-stat-quoted-marker)
   'noerror))