extfs patchfs update



Hello.

I've noticed, that patchfs is quite useless right now. I've updated it
to handle unified diffs (the most popular patch format), and I'm
working on the context diff format.

Now I work on fixing mailfs...

I'm including new patchfs as an attachment - if you want to, add it to
mc distribution.

Regards
alpha

ps. I've just subscribed to this list. I want to say I'm really happy,
that GNOME support has been thrown out of mc, and that the real mc is
now actively developed. Hope I can help...

-- 

  _.|._ |_  _.    : Adam Byrtek, alpha@(irc.pl|debian.org)
 (_|||_)| |(_|    : gg 1802819, pgp 0xB25952C0
     |            : jid alpha.jabberpl.org
#! /bin/sh

# Peter Daum <gator cs tu-berlin de> (Jan 1998, mc-4.1.22)

# modified to work with unified diffs, some additional fixes
# Adam Byrtek <alpha debian org>, 4 Dec 2002

# WARNING: look out for TAB (0x09) chars in sed patterns!
# (sed does not accept \t)


LC_ALL=C
export LC_ALL

# paths to used programs:
ncat=cat                  # regular cat
zcat=zcat                 # gunzip to stdout
bzcat="bzip2 -dc"         # bunzip2 to stdout
file=file                 # "file" command
sed=sed

filelist=FILELIST         # names for "special" files

patchfs_list ()
{
    # default attributes
    date=`date +"%b %d %H:%M"`
    perm="-r--r--r--"
    uid=00000000
    gid=00000000
    size=00000000
    nlink="  1"

    # filelist virtual file
    echo "$perm $nlink $uid $gid $size $date $filelist"

    $cat $1 |
    $sed -ne "/^--- / {
        s/^--- \([^ 	]*\).*/$perm $nlink $uid $gid $size $date \1/gp 
    }"
}

patchfs_copyout ()
{
    if [ "$2" = "$filelist" ]; then
        # list of all affected files
	$cat $1 |
        $sed -ne "/^--- / {
	    s/^--- \([^ 	]*\).*/\1/gp
	}" > $3
    else
        # escape '/' in filename
        fn=`echo $2 | $sed 's|/|\\\/|g'`
        $cat $1 | 
        $sed -ne "/^--- $fn/,/^--- / {
	    /^--- / {
	        /^--- $fn/p
	        d
	    }
            p
        }" > $3
     fi
     exit 0
}

patchfs_run ()
{
    exit 0
}

type=`$file $2`
case $type in
    *bzip*) cat=$bzcat ;;
    *gzip*) cat=$zcat ;;
    *text*) cat=$ncat ;;
    *) exit 1
esac

umask 077
case "$1" in
    list) patchfs_list $2; exit 0;;
    copyout) patchfs_copyout $2 $3 $4; exit 0;;
    run) patchfs_run; exit 0;;
esac

exit 1




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]