summaryrefslogtreecommitdiffstats
path: root/src/vfs/extfs/helpers/uarc.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:22:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:22:03 +0000
commitffccd5b2b05243e7976db80f90f453dccfae9886 (patch)
tree39a43152d27f7390d8f7a6fb276fa6887f87c6e8 /src/vfs/extfs/helpers/uarc.in
parentInitial commit. (diff)
downloadmc-0acba638a84ac029b0ce3ee33c0f8b7d9f3fa027.tar.xz
mc-0acba638a84ac029b0ce3ee33c0f8b7d9f3fa027.zip
Adding upstream version 3:4.8.30.upstream/3%4.8.30
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/vfs/extfs/helpers/uarc.in92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/vfs/extfs/helpers/uarc.in b/src/vfs/extfs/helpers/uarc.in
new file mode 100644
index 0000000..a81839a
--- /dev/null
+++ b/src/vfs/extfs/helpers/uarc.in
@@ -0,0 +1,92 @@
+#! /bin/sh
+
+#
+# ARC Virtual filesystem executive
+# Copyright (C) 2008 Jacques Pelletier
+# May be distributed under the terms of the GNU Public License
+# <jpelletier@ieee.org>
+#
+
+# Define which archiver you are using with appropriate options
+ARC_LIST=${MC_TEST_EXTFS_LIST_CMD:-"arc v"}
+ARC_GET="arc x"
+ARC_PUT="arc a"
+ARC_DEL="arc d"
+
+# The 'list' command executive
+
+mc_arc_fs_list()
+{
+ if [ "x$UID" = "x" ]; then
+ UID=`id -ru 2>/dev/null`
+ if [ "x$UID" = "x" ]; then
+ UID=0
+ fi
+ fi
+ $ARC_LIST "$1" | @AWK@ -v uid=$UID '
+BEGIN {
+ # Copied from uzoo.in.
+ split("Jan:Feb:Mar:Apr:May:Jun:Jul:Aug:Sep:Oct:Nov:Dec", month_list, ":")
+ for (i=1; i<=12; i++) {
+ month[month_list[i]] = i
+ }
+}
+/^Name/ { next }
+/===/ { next }
+/^Total/ { next }
+{
+ if ($8 > 50)
+ $8=$8 + 1900
+ else
+ $8=$8 + 2000
+
+ split($9, a, ":")
+
+ # convert AM/PM to 00-23
+ if (a[2] ~ /a$|p$/)
+ {
+ if (a[2] ~ /p$/)
+ a[1] = a[1]+12
+
+ a[2]=substr(a[2],1,2)
+ }
+
+ printf "-rw-r--r-- 1 %-8d %-8d %8d %02d-%02d-%04d %02d:%02d %s\n", uid, 0, $2, month[$7], $6, $8, a[1], a[2], $1
+}' 2>/dev/null
+ exit 0
+}
+
+# Command: copyout archivename storedfilename extractto
+mc_arc_fs_copyout()
+{
+ $ARC_GET "$1" "$2" 2> /dev/null
+ mv "$2" "$3"
+}
+
+# Command: copyin archivename storedfilename sourcefile
+mc_arc_fs_copyin()
+{
+ mv "$3" "$2"
+ $ARC_PUT "$1" "$2" 2> /dev/null
+}
+
+# Command: rm archivename storedfilename
+mc_arc_fs_rm()
+{
+ $ARC_DEL "$1" "$2" 2> /dev/null
+}
+
+# The main routine
+umask 077
+
+cmd="$1"
+shift
+
+case "$cmd" in
+ list) mc_arc_fs_list "$@" ;;
+ copyout) mc_arc_fs_copyout "$@" ;;
+ copyin) mc_arc_fs_copyin "$@" ;;
+ rm) mc_arc_fs_rm "$@" ;;
+ *) exit 1 ;;
+esac
+exit 0