1998-02-27 07:54:42 +03:00
|
|
|
#! /bin/sh
|
2000-04-12 13:25:07 +04:00
|
|
|
|
|
|
|
# Based on previous version of lslR
|
|
|
|
# Modified by Tomas Novak <tnovak@ipex.cz> April 2000
|
|
|
|
# (to allow spaces in filenames)
|
2002-12-12 11:34:24 +03:00
|
|
|
#
|
|
|
|
# It's assumed that lslR was generated in C locale.
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2000-04-12 13:25:07 +04:00
|
|
|
mclslRfs_list () {
|
1998-02-27 07:54:42 +03:00
|
|
|
case "$1" in
|
2002-12-12 11:34:24 +03:00
|
|
|
*.bz2) MYCAT="bzip2 -dc";;
|
|
|
|
*.gz) MYCAT="gzip -dc";;
|
|
|
|
*.z) MYCAT="gzip -dc";;
|
|
|
|
*.Z) MYCAT="gzip -dc";;
|
|
|
|
*) MYCAT="cat";;
|
1998-02-27 07:54:42 +03:00
|
|
|
esac
|
2000-04-12 13:25:07 +04:00
|
|
|
|
2001-02-23 11:45:13 +03:00
|
|
|
$MYCAT "$1" | @AWK@ '
|
2002-02-12 20:47:27 +03:00
|
|
|
BEGIN {
|
|
|
|
dir="";
|
|
|
|
# Pattern to match 8 first fields.
|
|
|
|
rx = "[^ ]+[ ]+";
|
|
|
|
rx = "^" rx rx rx rx rx rx rx rx;
|
|
|
|
}
|
1998-02-27 07:54:42 +03:00
|
|
|
/^total\ [0-9]*$/ { next }
|
|
|
|
/^$/ { next }
|
2001-02-23 11:45:13 +03:00
|
|
|
/^[^ ].*:$/ {
|
2000-04-12 13:25:07 +04:00
|
|
|
if ($0 ~ /^\//) dir=substr($0, 2);
|
|
|
|
else dir=$0;
|
|
|
|
if (dir ~ /\/:$/) sub(/:$/, "", dir);
|
|
|
|
else sub(/:$/, "/", dir);
|
|
|
|
next;
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
2002-02-12 20:47:27 +03:00
|
|
|
{ $9 != "" } {
|
|
|
|
# gensub() is not portable.
|
2001-02-23 11:45:13 +03:00
|
|
|
name=$0
|
2002-02-12 20:47:27 +03:00
|
|
|
sub(rx, "", name)
|
|
|
|
# Cannot assign to $9, or spaces in the filename would be reduced.
|
2001-02-23 11:45:13 +03:00
|
|
|
attr=substr($0, 1, length($0)-length(name))
|
|
|
|
printf "%s%s%s\n", attr, dir, name
|
2002-12-12 11:34:24 +03:00
|
|
|
}'
|
1998-02-27 07:54:42 +03:00
|
|
|
}
|
|
|
|
|
2002-12-12 11:34:24 +03:00
|
|
|
export LC_ALL="C"
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
case "$1" in
|
2000-04-12 13:25:07 +04:00
|
|
|
list) mclslRfs_list "$2"; exit 0;;
|
1998-02-27 07:54:42 +03:00
|
|
|
esac
|
|
|
|
exit 1
|