summaryrefslogtreecommitdiffstats
path: root/src/vfs/extfs/helpers/uarj.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:44:12 +0000
commit8ccb487c21368a7fdc8c7c72315325bf0aa06147 (patch)
treeb2056fae01d325924508a41731edfbd4c3cddd23 /src/vfs/extfs/helpers/uarj.in
parentInitial commit. (diff)
downloadmc-a8b95ffda99fa354ec15e9585f29f508e496986c.tar.xz
mc-a8b95ffda99fa354ec15e9585f29f508e496986c.zip
Adding upstream version 3:4.8.29.upstream/3%4.8.29upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/vfs/extfs/helpers/uarj.in')
-rw-r--r--src/vfs/extfs/helpers/uarj.in75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/vfs/extfs/helpers/uarj.in b/src/vfs/extfs/helpers/uarj.in
new file mode 100644
index 0000000..15549a0
--- /dev/null
+++ b/src/vfs/extfs/helpers/uarj.in
@@ -0,0 +1,75 @@
+#! /bin/sh
+#
+# Written by Viatcheslav Odintsov (2:5020/181)
+# (C) 2002 ARJ Software Russia.
+#
+# This is an updated parser for ARJ archives in Midnight Commander. You need
+# full ARJ rather than UNARJ. Open-source ARJ v 3.10 for Unix platforms can
+# be obtained here:
+#
+# - http://www.sourceforge.net/projects/arj/
+# - http://arj.sourceforge.net/
+
+
+ARJ="arj -+ -ja1"
+
+
+mcarjfs_list ()
+{
+ $ARJ v "$1" | @AWK@ -v uuid=$(id -ru) '
+ {
+ if (($0 ~ /^[0-9]+\) .*/)||($0 ~ /^------------ ---------- ---------- -----/)){
+ if (filestr ~ /^[0-9]+\) .*/) {
+ printf "%s 1 %-8d %-8d %8d %02d-%02d-%02d %02d:%02d %s%s\n", perm, uid, gid, size, date[2], date[3], date[1], time[1], time[2], file, symfile
+ perm=""
+ file=""
+ symfile=""
+ filestr=""
+ }
+ }
+
+ if ($0 ~ /^[0-9]+\) .*/) {
+ filestr=$0
+ sub(/^[0-9]*\) /, "")
+ file=$0
+ uid=uuid
+ gid=0
+ }
+
+ if ($0 ~ /^.* [0-9]+[\t ]+[0-9]+ [0-9]\.[0-9][0-9][0-9] [0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9].*/) {
+ size=$3
+ split($6, date, "-")
+ split($7, time, ":")
+ if ($8 ~ /^[rwx-]/) {perm=$8;}
+ else {perm="-rw-r--r--"}
+ }
+
+ if ($0 ~ /^[\t ]+SymLink -> .*/) {
+ symfile = " -> "$3
+ perm="l"substr(perm, 2)
+ }
+
+ if ($0 ~ /^[\t ]+Owner: UID [0-9]+\, GID [0-9]+/) {
+ uid=$3
+ gid=$5
+ owner=1
+ }
+ }'
+}
+
+
+mcarjfs_copyout ()
+{
+ $ARJ e -y "$1" "$2" -jw"$3" >/dev/null 2>/dev/null
+}
+
+
+umask 077
+cmd="$1"
+shift
+case "$cmd" in
+ list) mcarjfs_list "$@" ;;
+ copyout) mcarjfs_copyout "$@" ;;
+ *) exit 1 ;;
+esac
+exit 0