mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
Merge branch '1921_lslR_fix'
* 1921_lslR_fix: Ticket #1921: Fix lslR VFS
This commit is contained in:
commit
ba943581f2
@ -24,26 +24,42 @@ esac
|
||||
$MYCAT "$1" | $AWK '
|
||||
BEGIN {
|
||||
dir="";
|
||||
# Pattern to match 8 first fields.
|
||||
empty=1;
|
||||
rx = "[^ ]+[ ]+";
|
||||
rx = "^" rx rx rx rx rx rx rx rx;
|
||||
# Pattern to match 7 first fields.
|
||||
rx7 = "^" rx rx rx rx rx rx "[^ ]+[ ]";
|
||||
# Pattern to match 8 first fields.
|
||||
rx8 = "^" rx rx rx rx rx rx rx "[^ ]+[ ]";
|
||||
}
|
||||
/^total\ [0-9]*$/ { next }
|
||||
/^$/ { next }
|
||||
/^[^ ].*:$/ {
|
||||
/^$/ { empty=1; next }
|
||||
empty==1 && /:$/ {
|
||||
empty=0
|
||||
if ($0 ~ /^\//) dir=substr($0, 2);
|
||||
else dir=$0;
|
||||
if (dir ~ /\/:$/) sub(/:$/, "", dir);
|
||||
else sub(/:$/, "/", dir);
|
||||
if (dir ~ /^[ ]/) dir="./"dir;
|
||||
next;
|
||||
}
|
||||
( $9 != "" ) {
|
||||
( NF > 7 ) {
|
||||
empty=0
|
||||
# gensub() is not portable.
|
||||
name=$0
|
||||
sub(rx, "", name)
|
||||
# Cannot assign to $9, or spaces in the filename would be reduced.
|
||||
attr=substr($0, 1, length($0)-length(name))
|
||||
printf "%s%s%s\n", attr, dir, name
|
||||
i=index($6, "-")
|
||||
if (i) {
|
||||
sub(rx7, "", name)
|
||||
NF = 7
|
||||
$6=substr($6,i+1)"-"substr($6,1,i-1)
|
||||
}
|
||||
else {
|
||||
sub(rx8, "", name)
|
||||
NF = 8
|
||||
}
|
||||
printf "%s %s%s\n", $0, dir, name
|
||||
}
|
||||
{
|
||||
empty=0
|
||||
}'
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user