| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# This is a parser for ARC archive files in Midnight Commander. You need |
| 4 |
# the GPL nomarch program (version >= 1.3) written by Russell Marks. |
| 5 |
|
| 6 |
# Author: Guus Jansman |
| 7 |
|
| 8 |
# Alternative programs (not supported by this script): |
| 9 |
# arc (Howard Chu) |
| 10 |
|
| 11 |
# Settings: |
| 12 |
UNARC="nomarch" |
| 13 |
|
| 14 |
mcarcfs_list () |
| 15 |
{ |
| 16 |
$UNARC -lv "$1" | gawk -v uid=$(id -ru) ' |
| 17 |
BEGIN { date="JanFebMarAprMayJunJulAugSepOctNovDec" } |
| 18 |
{ |
| 19 |
split(substr($0, 14), t) |
| 20 |
str=substr($0, 1, 13) |
| 21 |
while (length(str) != 0 && substr(str, length(str), 1) == " ") |
| 22 |
{ |
| 23 |
str=substr(str, 1, length(str) - 1) |
| 24 |
} |
| 25 |
split(t[5], a, "-") |
| 26 |
perm="-rw-r--r--" |
| 27 |
printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", perm, uid, 0, t[4], substr(date, (a[2]-1)*3+1, 3), a[3], a[1], t[6], str |
| 28 |
}' |
| 29 |
} |
| 30 |
|
| 31 |
mcarcfs_copyout () |
| 32 |
{ |
| 33 |
$UNARC -p "$1" "$2" > "$3" 2>/dev/null |
| 34 |
} |
| 35 |
|
| 36 |
mcarcfs_test () |
| 37 |
{ |
| 38 |
if $UNARC -t "$1" >/dev/null 2>&1; then |
| 39 |
echo "OK" |
| 40 |
else |
| 41 |
echo "UNKNOWN" |
| 42 |
fi |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
umask 077 |
| 47 |
|
| 48 |
cmd="$1" |
| 49 |
shift |
| 50 |
case "$cmd" in |
| 51 |
list) mcarcfs_list "$@" ;; |
| 52 |
copyout) mcarcfs_copyout "$@" ;; |
| 53 |
# test) mcarcfs_test "$@" ;; # Not supported by MC extfs |
| 54 |
*) exit 1 ;; |
| 55 |
esac |
| 56 |
exit 0 |