mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
2001-03-07 Pavel Machek <pavel@bug.ucw.cz>
* extfs/*uzip*: replace uzip with perl version by Oskar Liljeblad <osk@hem.passagen.se>
This commit is contained in:
parent
33863474bb
commit
773f38c580
@ -1,3 +1,8 @@
|
||||
2001-03-07 Pavel Machek <pavel@bug.ucw.cz>
|
||||
|
||||
* extfs/*uzip*: replace uzip with perl version by
|
||||
Oskar Liljeblad <osk@hem.passagen.se>
|
||||
|
||||
2001-03-05 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* vfs.[ch] (vfs_parse_ls_lga, vfs_parse_filemode): p constified
|
||||
|
@ -6,7 +6,6 @@ ucpio
|
||||
ulha
|
||||
lslR
|
||||
uzoo
|
||||
uzip
|
||||
uar
|
||||
ftplist
|
||||
uha
|
@ -1,135 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Written by Jakub Jelinek 1995
|
||||
# Updated by Christian Gennerat 1999
|
||||
#
|
||||
# (C) 1995,1999 The Free Software Foundation.
|
||||
#
|
||||
#
|
||||
|
||||
DZIP=/usr/bin
|
||||
XZIP="$DZIP/zip -g"
|
||||
XDZIP="$DZIP/zip -d"
|
||||
XUNZIP="$DZIP/unzip"
|
||||
XZIPINFO="$DZIP/unzip -Z"
|
||||
|
||||
mczipfs_list ()
|
||||
{
|
||||
# Try zipinfo if available, fallback to unzip.
|
||||
if $XZIPINFO 2>&1 | grep ZipInfo >/dev/null; then
|
||||
$XZIPINFO -l "$1" 2>/dev/null | \
|
||||
@AWK@ -v uid=${UID-0} -v zipfile="$1" -v xunzip=$XUNZIP '
|
||||
# Zipinfo prints errors on stdout. Check mode and time to skip them.
|
||||
/^[^a-z\-]/ { next }
|
||||
($9 ~ /:/) {
|
||||
nam=$0
|
||||
sub(/^[^:]+:[^ ]+[ ]+/, "", nam)
|
||||
if ($1 ~ /^l/ ) {
|
||||
arrow=" -> "
|
||||
linkname=""
|
||||
cmd=xunzip " -p " zipfile " " nam
|
||||
cmd | getline linkname
|
||||
} else {
|
||||
arrow=""
|
||||
linkname=""
|
||||
}
|
||||
|
||||
# If mode is not UNIX-compatible, take first 4 characters.
|
||||
if (length($1) != 10)
|
||||
mode=substr($1, 1, 4) "------"
|
||||
else
|
||||
mode=$1
|
||||
|
||||
# Workaround for jar files - files ending with / are directories.
|
||||
if ($0 ~ /\/$/)
|
||||
sub(/^./, "d", mode)
|
||||
|
||||
if (nam ~ /^\^/)
|
||||
nam=substr(nam, 2)
|
||||
split($8, a, "-")
|
||||
if (a[3] < 50)
|
||||
a[3] = 2000 + a[3]
|
||||
else
|
||||
a[3] = 1900 + a[3]
|
||||
printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s%s%s\n", mode, uid, 0, $4, a[2], a[1], a[3], $9, nam, arrow, linkname
|
||||
next
|
||||
}' 2>/dev/null
|
||||
else
|
||||
$XUNZIP -v "$1" 2>/dev/null | @AWK@ -v uid=${UID-0} '
|
||||
# Not sure about portability of unzip -qq.
|
||||
# Check ratio to eliminate all but valid entries.
|
||||
($4 ~ /%$/) {
|
||||
if ($8 ~ /^\^/)
|
||||
$8=substr($8, 2)
|
||||
## Y2K patch. if Year>=2000, unzip returns Year>=100
|
||||
split($5, a, "-")
|
||||
if (a[3] > 99)
|
||||
a[3] = substr(a[3],2)
|
||||
if ($8 ~ /\/$/)
|
||||
printf "drwxr-xr-x 1 %-8d %-8d %8d %s-%s-%s %s %s\n", uid, 0, $1, a[1],a[2],a[3], $6, $8
|
||||
else
|
||||
printf "-rw-r--r-- 1 %-8d %-8d %8d %s-%s-%s %s %s\n", uid, 0, $1, a[1],a[2],a[3], $6, $8
|
||||
}' 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
mczipfs_mkdir ()
|
||||
{
|
||||
# preserve pwd. It is clean, but is it necessary?
|
||||
pwd=`pwd`
|
||||
# Create a directory and create in it a tmp directory with the good name
|
||||
dir=tmpdir.${RANDOM}
|
||||
mkdir $dir
|
||||
cd $dir
|
||||
mkdir -p "$2"
|
||||
$XZIP "$1" "$2" &>/dev/null
|
||||
cd $pwd
|
||||
rm -rf $dir
|
||||
}
|
||||
|
||||
mczipfs_copyin ()
|
||||
{
|
||||
# preserve pwd. It is clean, but is it necessary?
|
||||
pwd=`pwd`
|
||||
# Create a directory and copy in it the tmp file with the good name
|
||||
mkdir $3.dir
|
||||
cd $3.dir
|
||||
di="${2%/*}"
|
||||
# if file is to be written upper in the archive tree, make fake dir
|
||||
if test "$di" != "${2##*/}" ; then
|
||||
mkdir -p "$di"
|
||||
fi
|
||||
# (cp -p) to preserve date, but $2 is dated now!
|
||||
cp -p $3 "$3.dir/$2"
|
||||
$XZIP "$1" "$2" >/dev/null
|
||||
cd $pwd
|
||||
rm -rf $3.dir
|
||||
}
|
||||
|
||||
mczipfs_copyout ()
|
||||
{
|
||||
$XUNZIP -p "$1" "$2" > "$3" 2>/dev/null
|
||||
}
|
||||
|
||||
mczipfs_rm ()
|
||||
{
|
||||
$XDZIP "$1" "$2" &>/dev/null
|
||||
}
|
||||
|
||||
mczipfs_rmdir ()
|
||||
{
|
||||
$XDZIP "$1" "$2"/ &>/dev/null
|
||||
}
|
||||
|
||||
umask 077
|
||||
|
||||
#echo "`date +%T` ${0##*/} $1 $2 to=$3 tmp=$4" >>~/tmp/${0##*/}.log
|
||||
case "$1" in
|
||||
list) mczipfs_list "$2"; exit 0;;
|
||||
rm) mczipfs_rm "$2" "$3" ; exit 0;;
|
||||
rmdir) mczipfs_rmdir "$2" "$3" ; exit 0;;
|
||||
mkdir) mczipfs_mkdir "$2" "$3" ; exit 0;;
|
||||
copyin) mczipfs_copyin "$2" "$3" "$4" ; exit 0;;
|
||||
copyout) mczipfs_copyout "$2" "$3" "$4" ; exit 0;;
|
||||
esac
|
||||
exit 1
|
Loading…
Reference in New Issue
Block a user