Variable: tramp-perl-file-attributes
tramp-perl-file-attributes is a variable defined in tramp-sh.el.gz.
Value
"%p -e '\n@stat = lstat($ARGV[0]);\nif (!@stat) {\n print \"nil\\n\";\n exit 0;\n}\nif (($stat[2] & 0170000) == 0120000)\n{\n $type = readlink($ARGV[0]);\n $type =~ s/\"/\\\\\"/g;\n $type = \"\\\"$type\\\"\";\n}\nelsif (($stat[2] & 0170000) == 040000)\n{\n $type = \"t\";\n}\nelse\n{\n $type = \"nil\"\n};\nprintf(\n \"(%%s %%u (%%s . %%u) (%%s . %%u) (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t %%u -1)\\n\",\n $type,\n $stat[3],\n \"\\\"\" . getpwuid($stat[4]) . \"\\\"\",\n $stat[4],\n \"\\\"\" . getgrgid($stat[5]) . \"\\\"\",\n $stat[5],\n $stat[8] >> 16 & 0xffff,\n $stat[8] & 0xffff,\n $stat[9] >> 16 & 0xffff,\n $stat[9] & 0xffff,\n $stat[10] >> 16 & 0xffff,\n $stat[10] & 0xffff,\n $stat[7],\n $stat[2],\n $stat[1]\n);' \"$1\" %n"
Documentation
Perl script to produce output suitable for use with file-attributes
on the remote file system.
Format specifiers are replaced by tramp-expand-script, percent
characters need to be doubled.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
;; Perl script to implement `file-attributes' in a Lisp `read'able
;; output. If you are hacking on this, note that you get *no* output
;; unless this spits out a complete line, including the '\n' at the
;; end.
;; The device number is returned as "-1", because there will be a virtual
;; device number set in `tramp-sh-handle-file-attributes'.
(defconst tramp-perl-file-attributes "\
%p -e '
@stat = lstat($ARGV[0]);
if (!@stat) {
print \"nil\\n\";
exit 0;
}
if (($stat[2] & 0170000) == 0120000)
{
$type = readlink($ARGV[0]);
$type =~ s/\"/\\\\\"/g;
$type = \"\\\"$type\\\"\";
}
elsif (($stat[2] & 0170000) == 040000)
{
$type = \"t\";
}
else
{
$type = \"nil\"
};
printf(
\"(%%s %%u (%%s . %%u) (%%s . %%u) (%%u %%u) (%%u %%u) (%%u %%u) %%u %%u t %%u -1)\\n\",
$type,
$stat[3],
\"\\\"\" . getpwuid($stat[4]) . \"\\\"\",
$stat[4],
\"\\\"\" . getgrgid($stat[5]) . \"\\\"\",
$stat[5],
$stat[8] >> 16 & 0xffff,
$stat[8] & 0xffff,
$stat[9] >> 16 & 0xffff,
$stat[9] & 0xffff,
$stat[10] >> 16 & 0xffff,
$stat[10] & 0xffff,
$stat[7],
$stat[2],
$stat[1]
);' \"$1\" %n"
"Perl script to produce output suitable for use with `file-attributes'
on the remote file system.
Format specifiers are replaced by `tramp-expand-script', percent
characters need to be doubled.")