From 27a09e8635af6e054bed1af5e973d91c87249eda Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Wed, 21 Apr 1999 10:55:07 +0000 Subject: [PATCH] Roll in changes from "christian.gennerat" --- vfs/ChangeLog | 6 ++++++ vfs/extfs/urar.in | 40 +++++++++++++++++++++++++++++------ vfs/extfs/uzip.in | 54 +++++++++++++++++++++++++++++++++++------------ 3 files changed, 79 insertions(+), 21 deletions(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index d7a24b9d0..0c6c783c2 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,9 @@ +1999-04-21 Pavel Machek + + * urar.in, uzip.in: rolled in patches from "christian.gennerat" + for better handling of + spaces and copyin-feature-addon. + 1999-04-18 Miguel de Icaza * extfs.c (get_path_from_entry): Fix a crash here. diff --git a/vfs/extfs/urar.in b/vfs/extfs/urar.in index 5d7943c7f..27bfc6a88 100644 --- a/vfs/extfs/urar.in +++ b/vfs/extfs/urar.in @@ -2,9 +2,12 @@ # # Written by andrey joukov # (C) 1996 2:5020/337.13@fidonet.org -# beta version 1.0 +# Updated by christian.gennerat@alcatel.fr 1999 +# beta version 2.0 # -UNRAR=rar +DRAR=/usr/bin +RAR=$DRAR/rar +UNRAR=$DRAR/unrar # Prefer unrar (freeware) # # NOTE: rar ver 2.0 by Eugene Roshal # ftp.elf.stuba.sk/pub/pc/pack @@ -12,12 +15,12 @@ UNRAR=rar mcrarfs_list () { - $UNRAR v -c- $1 | @AWK@ -v uid=${UID-0} ' + $UNRAR v -c- "$1" | @AWK@ -v uid=${UID-0} ' BEGIN { flag=0; date="JanFebMarAprMayJunJulAugSepOctNovDec" } /^-------/ { flag++; if (flag > 1) exit 0; next } { if (flag == 0) next -if (NF == 1) str = $1 +if ( !/ [0-9][0-9]:[0-9][0-9] /) str = $0 # there is no time spec in this line else { if (str ~ /^\^/) str=substr(str, 2) @@ -36,14 +39,37 @@ else { }' 2>/dev/null } +mcrarfs_copyin () +{ +# copyin by christian.gennerat@alcatel.fr +# 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" + $RAR a "$1" "$2" >/dev/null + cd $pwd + rm -rf $3.dir +} + mcrarfs_copyout () { - $UNRAR p -c- -inul $1 $2 > $3 2>/dev/null + $UNRAR p -c- -inul "$1" "$2" > $3 2>/dev/null } umask 077 +# uncomment this line for debugging +#echo "`date +%T` ${0##*/} $1 $2 to=$3 tmp=$4" >>/tmp/${0##*/}.log case "$1" in - list) mcrarfs_list $2; exit 0;; - copyout) mcrarfs_copyout $2 $3 $4; exit 0;; + list) mcrarfs_list "$2"; exit 0;; + copyin) mcrarfs_copyin "$2" "$3" $4; exit 0;; + copyout) mcrarfs_copyout "$2" "$3" $4; exit 0;; esac exit 1 diff --git a/vfs/extfs/uzip.in b/vfs/extfs/uzip.in index cb8efb103..ec4ecd7ec 100644 --- a/vfs/extfs/uzip.in +++ b/vfs/extfs/uzip.in @@ -1,13 +1,16 @@ #! /bin/sh # # Written by Jakub Jelinek 1995 +# Updated by Christian Gennerat 1999 # -# (C) 1995 The Free Software Foundation. +# (C) 1995,1999 The Free Software Foundation. # # -XZIP=zip -XUNZIP=unzip -XZIPINFO="unzip -Z" + +DZIP=/usr/bin +XZIP="$DZIP/zip -g" +XUNZIP="$DZIP/unzip" +XZIPINFO="$DZIP/unzip -Z" # #If you don't have zipinfo, set ZIPINFO= # @@ -17,28 +20,30 @@ mczipfs_list () DOZIPINFO=no if test -n "$XZIPINFO"; then DOZIPINFO= - $XZIPINFO -l $1 | @AWK@ -v uid=${UID-0} -v zipfile=$1 -v xunzip=${XUNZIP-unzip} ' + $XZIPINFO -l "$1" | @AWK@ -v uid=${UID-0} -v zipfile=$1 -v xunzip=${XUNZIP-unzip} ' /^Archive/ { next } /^[0-9]*\ file/ { next } /unx/ { +split($0,a,":") +nam = substr(a[2],4) if ($1 ~ /^l/ ) { arrow=" -> " linkname="" - cmd=xunzip " -p " zipfile " " $10 + cmd=xunzip " -p " zipfile " " nam cmd | getline linkname } else { arrow="" linkname="" } -if ($10 ~ /^\^/) - $10=substr($10, 2) +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", $1, uid, 0, $4, a[2], a[1], a[3], $9, $10, arrow, linkname +printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s%s%s\n", $1, uid, 0, $4, a[2], a[1], a[3], $9, nam, arrow, linkname next } { @@ -49,7 +54,7 @@ exit 214 fi fi if test -n "$DOZIPINFO"; then - $XUNZIP -v $1 | @AWK@ -v uid=${UID-0} ' + $XUNZIP -v "$1" | @AWK@ -v uid=${UID-0} ' BEGIN { hyphens=0 } /^Archive/ { next } /^\ Length/ { next } @@ -66,15 +71,36 @@ else fi } -mczipfs_copyout () +mczipfs_copyin () { - $XUNZIP -p $1 $2 > $3 2>/dev/null +# 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 +} umask 077 +#echo "`date +%T` ${0##*/} $1 $2 to=$3 tmp=$4" >>/tmp/${0##*/}.log case "$1" in - list) mczipfs_list $2; exit 0;; - copyout) mczipfs_copyout $2 $3 $4; exit 0;; + list) mczipfs_list "$2"; exit 0;; +# delete) mczipfs_delete "$2" "$3" ; exit 0;; + copyin) mczipfs_copyin "$2" "$3" $4 ; exit 0;; + copyout) mczipfs_copyout "$2" "$3" $4 ; exit 0;; esac exit 1