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 }
36 if ( !/ [0-9][0-9]:[0-9][0-9] /) str = $0 # there is no time spec in this line
41 if (index($6, "D") != 0)
44 if (index($6, ".") != 0)
46 printf "%s 1 %s %s %d %02d/%02d/%02d %s %s\n", $6, uid, gid, $1, a[2], a[1], a[3], $5, str
53 # copyin by christian.gennerat@alcatel.fr
54 # preserve pwd. It is clean, but is it necessary?
56 # Create a directory and copy in it the tmp file with the good name
60 # if file is to be written upper in the archive tree, make fake dir
61 if test x
"$di" != x
"${2##*/}" ; then
64 cp -fp "$3" "$3.dir/$2"
65 $RAR a
"$1" "$2" >/dev
/null
72 $UNRAR p
-p- -c- -inul "$1" "$2" > "$3"
77 # preserve pwd. It is clean, but is it necessary?
79 # Create a directory and create in it a tmp directory with the good name
80 dir
=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-urar.XXXXXX"` ||
exit 1
83 # rar cannot create an empty directory
85 $RAR a
-r "$1" "$2" >/dev
/null
86 $RAR d
"$1" "$2/.rarfs" >/dev
/null
93 $RAR d
"$1" "$2" >/dev
/null
105 # Workaround for a bug in mc - directories must precede files to
106 # avoid duplicate entries, so we sort output by filenames
107 list
) mcrarfs_list
"$@" |
sort -k 8 ;;
108 rm) mcrarfs_rm
"$@" ;;
109 rmdir) mcrarfs_rm
"$@" ;;
110 mkdir
) mcrarfs_mkdir
"$@" ;;
111 copyin
) mcrarfs_copyin
"$@" ;;
112 copyout
) mcrarfs_copyout
"$@" ;;