mirror of
https://github.com/MidnightCommander/mc
synced 2025-02-09 11:54:12 +03:00
62 lines
1.2 KiB
Bash
62 lines
1.2 KiB
Bash
#! /bin/sh
|
|
#
|
|
# Written by Pavel Roskin
|
|
# Copyright (C) 2002 Free Software Foundation.
|
|
#
|
|
# This filesystem doesn't support file extraction due to limitations of
|
|
# unarj, which cannot extract a single file.
|
|
|
|
|
|
UNARJ=unarj
|
|
|
|
mcarjfs_list ()
|
|
{
|
|
TMPDIR="/tmp/mctmpdir-uarj.$$"
|
|
mkdir $TMPDIR || exit 1
|
|
cd $TMPDIR
|
|
|
|
# "unarj t" gives filenames with path, "unarj l" gives other attributes
|
|
$UNARJ t "$1" | grep "^Testing" | cut -c 12-38 >testlist
|
|
$UNARJ l "$1" | sed -n -e '/------------/,/------------/p' | \
|
|
sed -e '1d;$d' | cut -c 1-58 >list
|
|
|
|
# Put long names into environment variables name_N
|
|
i=0
|
|
exec <testlist
|
|
while read name; do
|
|
eval name_$i=\$name
|
|
i=$(($i+1))
|
|
done
|
|
|
|
# Combine long names with the listing
|
|
i=0
|
|
exec <list
|
|
while read fname size ignore1 ignore2 fdate ftime; do
|
|
eval name=\$name_$i
|
|
: ${name=$fname}
|
|
# Date is originally YY-MM-DD, make it MM-DD-YY
|
|
mdy_date=`echo $fdate | sed 's/\(..\)-\(..\)-\(..\)/\2-\3-\1/'`
|
|
echo "-rw-r--r-- 1 root root $size $mdy_date $ftime $name"
|
|
i=$(($i+1))
|
|
done
|
|
|
|
cd /
|
|
rm -rf $TMPDIR
|
|
}
|
|
|
|
LC_ALL=C
|
|
export LC_ALL
|
|
|
|
LANG=C
|
|
export LANG
|
|
|
|
cmd="$1"
|
|
shift
|
|
|
|
case "$cmd" in
|
|
list) mcarjfs_list "$@" ;;
|
|
*) exit 1 ;;
|
|
esac
|
|
|
|
exit 0
|