summaryrefslogtreecommitdiffstats
path: root/src/vfs/extfs/helpers/ucab.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/ucab.in
parentInitial commit. (diff)
downloadmc-ffccd5b2b05243e7976db80f90f453dccfae9886.tar.xz
mc-ffccd5b2b05243e7976db80f90f453dccfae9886.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/ucab.in')
-rw-r--r--src/vfs/extfs/helpers/ucab.in40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/vfs/extfs/helpers/ucab.in b/src/vfs/extfs/helpers/ucab.in
new file mode 100644
index 0000000..252c8ca
--- /dev/null
+++ b/src/vfs/extfs/helpers/ucab.in
@@ -0,0 +1,40 @@
+#! /bin/sh
+
+CAB=cabextract
+
+mccabfs_list ()
+{
+ $CAB -l "$1" | @AWK@ -v uid=`id -un` -v gid=`id -gn` '
+BEGIN { flag=0 }
+/^-------/ { flag++; if (flag > 1) exit 0; next }
+{
+if (flag == 0) next
+if (length($6) == 0) next
+pr="-rw-r--r--"
+split($3, a, ".")
+split($4, b, ":")
+printf "%s 1 %s %s %d %02d/%02d/%02d %02d:%02d %s\n", pr, uid, gid, $1, a[2], a[1], a[3], b[1], b[2], $6
+}'
+
+}
+
+mccabfs_copyout ()
+{
+ $CAB -F "$2" -p "$1" > "$3"
+}
+
+LC_ALL=C
+export LC_ALL
+
+umask 077
+
+cmd="$1"
+
+case "$cmd" in
+ # Workaround for a bug in mc - directories must precede files to
+ # avoid duplicate entries, so we sort output by filenames
+ list) mccabfs_list "$2" ;;
+ copyout) mccabfs_copyout "$2" "$3" "$4" ;;
+ *) exit 1 ;;
+esac
+exit 0