mc/vfs/extfs/uarj
Pavel Roskin c055823512 * extfs/uarj: New list-only implementation that doesn't need
patched unarj.
* extfs/unarj.diff: Remove.
* extfs/Makefile.am: Remove extfs/unarj.diff.
2002-12-13 07:20:54 +00:00

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