Ticket #3599: provide major/minor info for block/char devices (FISH)

Perl ls helper did not provide major/minor info for block/char devices,
and `ls -lan` wasn't working because of a typo.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
Andreas Mohr 2016-02-27 19:25:30 +00:00 committed by Yury V. Zaytsev
parent d5668b60b6
commit ee6dd89deb

View File

@ -107,7 +107,7 @@ while read p l u g a i m d y n n2 n3; do
n=$n" "$n2" "$n3
fi
echo "P$p $u $g"
echo "S$s"
echo "E$a$i"
echo "d$m $d $y"
echo ":"$n
echo
@ -138,6 +138,10 @@ while((my $filename = readdir (DIR))){
my $linkname = readlink ("$dirname/$filename");
$linkname =~ $strutils_shell_escape_regex;
printf("R%%o %%o $uid.$gid\nS$size\nd$mloctime\n:\"%%s\" -> \"%%s\"\n\n", S_IMODE($mode), S_IFMT($mode), $e_filename, $linkname);
} elseif (S_ISCHR ($mode) || S_ISBLK ($mode)) {
my $minor = $rdev % 256;
my $major = int( $rdev / 256 );
printf("R%%o %%o $uid.$gid\nE$major,$minor\nd$mloctime\n:\"%%s\"\n\n", S_IMODE($mode), S_IFMT($mode), $e_filename);
} else {
printf("R%%o %%o $uid.$gid\nS$size\nd$mloctime\n:\"%%s\"\n\n", S_IMODE($mode), S_IFMT($mode), $e_filename);
}