/usr/lib/mc/fish/ls is in mc 3:4.8.13-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | #LIST /${FISH_DIR}
LC_TIME=C
export LC_TIME
perl_res="1"
fish_list_lsq ()
{
FISH_DIR="$1"
ls -Qlan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | (
while read p l u g s m d y n; do
echo "P$p $u.$g"
echo "S$s"
echo "d$m $d $y"
echo ":$n"
echo
done
)
ls -Qlan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | (
while read p l u g a i m d y n; do
echo "P$p $u.$g"
echo "E$a$i"
echo "d$m $d $y"
echo ":$n"
echo
done
)
echo '### 200'
}
fish_list_sed ()
{
FISH_DIR="$1"
ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | (
while read p l u g s rec; do
if [ -n "$g" ]; then
if [ -n "$FISH_HAVE_DATE_MDYT" ]; then
filename=`echo "$rec"| sed 's/[^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+ //'`
filedate=`echo "$rec"| sed 's/\([^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+\) .*/\1/'`
else
filename=`echo "$rec"| sed 's/[^[:space:]]\+ \+[^[:space:]]\+ //'`
filedate=`echo "$rec"| sed 's/\([^[:space:]]\+ \+[^[:space:]]\+\) .*/\1/'`
fi
pfile=\"`echo "$filename" | sed -e 's#^\(.*\) -> \(.*\)#\1" -> "\2#'`\"
echo "P$p $u.$g"
echo "S$s"
if [ -n "$FISH_HAVE_DATE_MDYT" ]; then
echo "d$filedate"
else
echo "D$filedate"
fi
echo ":$pfile"
echo
fi
done
)
ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | (
while read p l u g a i rec; do
if [ -n "$g" ]; then
if [ -n "$FISH_HAVE_DATE_MDYT" ]; then
filename=`echo "$rec"| sed 's/[^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+ //'`
filedate=`echo "$rec"| sed 's/\([^[:space:]]\+ \+[^[:space:]]\+ \+[^[:space:]]\+\) .*/\1/'`
else
filename=`echo "$rec"| sed 's/[^[:space:]]\+ \+[^[:space:]]\+ //'`
filedate=`echo "$rec"| sed 's/\([^[:space:]]\+ \+[^[:space:]]\+\) .*/\1/'`
fi
pfile=\"`echo "$filename" | sed -e 's#^\(.*\) -> \(.*\)#\1" -> "\2#'`\"
echo "P$p $u.$g"
echo "E$a$i"
if [ -n "$FISH_HAVE_DATE_MDYT" ]; then
echo "d$filedate"
else
echo "D$filedate"
fi
echo ":$pfile"
echo
fi
done
)
echo '### 200'
}
fish_list_poor_ls ()
{
FISH_DIR="$1"
ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | (
while read p l u g s m d y n n2 n3; do
if [ -n "$g" ]; then
if [ "$m" = "0" ]; then
s=$d; m=$y; d=$n; y=$n2; n=$n3
else
n=$n" "$n2" "$n3
fi
echo "P$p $u $g"
echo "S$s"
echo "d$m $d $y"
echo ":"$n
echo
fi
done
)
ls -lan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | (
while read p l u g a i m d y n n2 n3; do
if [ -n "$g" ]; then
if [ "$a" = "0" ]; then
a=$m; i=$d; m=$y; d=$n; y=$n2; n=$n3
else
n=$n" "$n2" "$n3
fi
echo "P$p $u $g"
echo "S$s"
echo "d$m $d $y"
echo ":"$n
echo
fi
done
)
echo '### 200'
}
fish_list_perl ()
{
FISH_DIR=$1
perl -e '
use strict;
use POSIX;
use Fcntl;
use POSIX ":fcntl_h"; #S_ISLNK was here until 5.6
import Fcntl ":mode" unless defined &S_ISLNK; #and is now here
my $dirname = $ARGV[0];
if (opendir (DIR, $dirname)) {
while((my $filename = readdir (DIR))){
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat("$dirname/$filename");
my $mloctime= strftime("%%m-%%d-%%Y %%H:%%M", localtime $mtime);
my $strutils_shell_escape_regex = s/([;<>\*\|`&\$!#\(\)\[\]\{\}:'\''"\ \\])/\\$1/g;
my $e_filename = $filename;
$e_filename =~ $strutils_shell_escape_regex;
if (S_ISLNK ($mode)) {
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);
} else {
printf("R%%o %%o $uid.$gid\nS$size\nd$mloctime\n:\"%%s\"\n\n", S_IMODE($mode), S_IFMT($mode), $e_filename);
}
}
printf("### 200\n");
closedir(DIR);
} else {
printf("### 500\n");
}
exit 0
' "/${FISH_DIR}"
perl_res=$?
}
if [ -n "${FISH_HAVE_PERL}" ]; then
fish_list_perl "/${FISH_FILENAME}"
fi
if [ "${perl_res}" != "0" ]; then
if [ -n "${FISH_HAVE_LSQ}" ]; then
fish_list_lsq "/${FISH_FILENAME}"
elif [ -n "${FISH_HAVE_SED}" ]; then
fish_list_sed "/${FISH_FILENAME}"
else
fish_list_poor_ls "/${FISH_FILENAME}"
fi
fi
|