summaryrefslogtreecommitdiffstats
path: root/src/vfs/extfs/helpers/uar.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/uar.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 'src/vfs/extfs/helpers/uar.in')
-rw-r--r--src/vfs/extfs/helpers/uar.in60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/vfs/extfs/helpers/uar.in b/src/vfs/extfs/helpers/uar.in
new file mode 100644
index 0000000..269bdb6
--- /dev/null
+++ b/src/vfs/extfs/helpers/uar.in
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Written by Alex Kuchma <ask@bcs.zp.ua>
+# Alex Tkachenko <alex@bcs.zp.ua>
+# Updated by Vitezslav Samel <xsamel00@dcse.fee.vutbr.cz>
+#
+# (C) 1997, 1998 The Free Software Foundation.
+#
+#
+
+XAR=ar
+
+mcarfs_list ()
+{
+ # If $temp_replace string is part of the filename that part might get lost
+ temp_replace='Unique Separator String'
+ thisyear="`date +%Y`"
+ $XAR tv "$1" | sed 's,^,-,;s, , 1 ,;s,/, ,' |
+ sed -e "s/\( [0-2][0-9]\:[0-5][0-9]\)\( $thisyear \)\(.*\)/\1$temp_replace\3/" |
+ sed -e "s/\( [0-2][0-9]\:[0-5][0-9] \)\([12][0-9][0-9][0-9] \)\(.*\)/ \2\3/" |
+ sed -e "s/$temp_replace/ /"
+}
+
+mcarfs_copyout ()
+{
+ $XAR p "$1" "$2" > "$3"
+}
+
+mcarfs_copyin ()
+{
+ TMPDIR=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-uar.XXXXXX"` || exit 1
+ name=`basename "$2"`
+ (cd "$TMPDIR" && cp -fp "$3" "$name" && $XAR r "$1" "$name")
+ rm -rf "$TMPDIR"
+}
+
+mcarfs_rm ()
+{
+ $XAR d "$1" "$2"
+}
+
+# override any locale for dates
+LC_ALL=C
+export LC_ALL
+
+umask 077
+case "$1" in
+ list) mcarfs_list "$2" ;;
+ copyout) shift; mcarfs_copyout "$@" ;;
+ copyin) shift; mcarfs_copyin "$@" ;;
+ rm) shift; mcarfs_rm "$@" ;;
+ mkdir|rmdir)
+ echo "mcarfs: ar archives cannot contain directories." 1>&2
+ exit 1;;
+ *)
+ echo "mcarfs: unknown command: \"$1\"." 1>&2
+ exit 1;;
+esac
+
+exit 0