3 # Written by andrey joukov
4 # (C) 1996 2:5020/337.13@fidonet.org
5 # Updated by christian.gennerat@alcatel.fr 1999
6 # Andrew V. Samoilov <sav@bcs.zp.ua> 2000
9 # rar and unrar can be found on http://www.rarlabs.com/
14 # Prefer unrar (freeware). Try to find unrar in $PATH.
15 save_IFS
="$IFS"; IFS
=:
18 test -z "$dir" && dir
=.
19 if test -x "$dir/unrar" -a -f "$dir/unrar"; then
25 if [ ! -x $UNRAR -a -x $RAR ]; then
31 $UNRAR v
-c- "$1" | @AWK@
-v uid
=`id -u` -v gid
=`id -g` '
33 /^-------/ { flag++; if (flag > 1) exit 0; next }
38 if (index($6, "D") != 0)
41 if (index($6, ".") != 0)
43 printf "%s 1 %s %s %d %02d/%02d/%02d %s %s\n", $6, uid, gid, $1, a[2], a[1], a[3], $5, str
49 # copyin by christian.gennerat@alcatel.fr
50 # preserve pwd. It is clean, but is it necessary?
52 # Create a directory and copy in it the tmp file with the good name
56 # if file is to be written upper in the archive tree, make fake dir
57 if test x
"$di" != x
"${2##*/}" ; then
60 cp -fp "$3" "$3.dir/$2"
61 $RAR a
"$1" "$2" >/dev
/null
68 $UNRAR p
-p- -c- -inul "$1" "$2" > "$3"
73 # preserve pwd. It is clean, but is it necessary?
75 # Create a directory and create in it a tmp directory with the good name
76 dir
=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-urar.XXXXXX"` ||
exit 1
79 # rar cannot create an empty directory
81 $RAR a
-r "$1" "$2" >/dev
/null
82 $RAR d
"$1" "$2/.rarfs" >/dev
/null
89 $RAR d
"$1" "$2" >/dev
/null
101 # Workaround for a bug in mc - directories must precede files to
102 # avoid duplicate entries, so we sort output by filenames
103 list
) mcrarfs_list
"$@" |
sort -k 8 ;;
104 rm) mcrarfs_rm
"$@" ;;
105 rmdir) mcrarfs_rm
"$@" ;;
106 mkdir
) mcrarfs_mkdir
"$@" ;;
107 copyin
) mcrarfs_copyin
"$@" ;;
108 copyout
) mcrarfs_copyout
"$@" ;;