In case I'm not the only one that uses Diaz's lzip, here is a code patch that should help in getting them to work together.

My modified #ulha is enclosed as well, as the standard issue has trouble with two cases, both of which are solved (for small values of 'solved', anyway) here: 1. Lack of date/time info. On clock-less systems, archivers would often zero these fields out. This may be represented on listing with blanks rather than an arbitrary default date.
2. Filenames with blanks. Yes, they do exist.

Reynir Heiðberg Stefánsson<reyni...@mi.is>
--
Vanquish, v.: To totally pwn someone.

diff -Purp mc-4.7.0.4/lib/util.c mc-4.7.0.4-rhs/lib/util.c
--- mc-4.7.0.4/lib/util.c       2010-04-02 07:02:19.000000000 +0000
+++ mc-4.7.0.4-rhs/lib/util.c   2010-04-29 11:44:11.000000000 +0000
@@ -976,6 +976,11 @@ get_compression_type (int fd, const char
     if (mc_read (fd, (char *) magic + 4, 2) != 2)
         return COMPRESSION_NONE;
 
+    /* LZIP utils format */
+    if (magic[0] == 'L' && magic[1] == 'Z'
+        && magic[2] == 'I' && magic[3] == 'P' && ( magic[4] == 0x00 || 
magic[4] == 0x01))
+        return COMPRESSION_LZIP;
+
     /* LZMA utils format */
     if (magic[0] == 0xFF
         && magic[1] == 'L'
@@ -1008,6 +1013,8 @@ decompress_extension (int type)
         return "#ubz";
     case COMPRESSION_BZIP2:
         return "#ubz2";
+    case COMPRESSION_LZIP:
+        return "#ulzip";
     case COMPRESSION_LZMA:
         return "#ulzma";
     case COMPRESSION_XZ:
diff -Purp mc-4.7.0.4/lib/util.h mc-4.7.0.4-rhs/lib/util.h
--- mc-4.7.0.4/lib/util.h       2010-04-02 07:02:09.000000000 +0000
+++ mc-4.7.0.4-rhs/lib/util.h   2010-04-29 11:33:20.000000000 +0000
@@ -195,6 +195,7 @@ enum compression_type {
        COMPRESSION_GZIP,
        COMPRESSION_BZIP,
        COMPRESSION_BZIP2,
+       COMPRESSION_LZIP,
        COMPRESSION_LZMA,
        COMPRESSION_XZ
 };
diff -Purp mc-4.7.0.4/lib/vfs/mc-vfs/extfs/iso9660.in 
mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/iso9660.in
--- mc-4.7.0.4/lib/vfs/mc-vfs/extfs/iso9660.in  2010-03-23 13:36:04.000000000 
+0000
+++ mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/iso9660.in      2010-04-29 
11:36:49.000000000 +0000
@@ -31,6 +31,7 @@ mcisofs_list () {
 case "$1" in
   *.lzma) MYCAT="lzma -dc";;
   *.xz)  MYCAT="xz -dc";;
+  *.lz)  MYCAT="lzip -dc";;
   *.bz2) MYCAT="bzip2 -dc";;
   *.gz)  MYCAT="gzip -dc";;
   *.z)   MYCAT="gzip -dc";;
diff -Purp mc-4.7.0.4/lib/vfs/mc-vfs/extfs/lslR.in 
mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/lslR.in
--- mc-4.7.0.4/lib/vfs/mc-vfs/extfs/lslR.in     2010-03-23 13:36:04.000000000 
+0000
+++ mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/lslR.in 2010-04-29 11:37:25.000000000 
+0000
@@ -14,6 +14,7 @@ mclslRfs_list () {
 case "$1" in
   *.lzma) MYCAT="lzma -dc";;
   *.xz)  MYCAT="xz -dc";;
+  *.lz)  MYCAT="lzip -dc";;
   *.bz2) MYCAT="bzip2 -dc";;
   *.gz)  MYCAT="gzip -dc";;
   *.z)   MYCAT="gzip -dc";;
diff -Purp mc-4.7.0.4/lib/vfs/mc-vfs/extfs/mailfs.in 
mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/mailfs.in
--- mc-4.7.0.4/lib/vfs/mc-vfs/extfs/mailfs.in   2010-03-23 13:36:04.000000000 
+0000
+++ mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/mailfs.in       2010-04-29 
11:38:55.000000000 +0000
@@ -8,6 +8,7 @@ use bytes;
 $zcat="zcat";                 # gunzip to stdout
 $bzcat="bzip2 -dc";           # bunzip2 to stdout
 $lzcat="lzma -dc";            # unlzma to stdout
+$lzkat="lzip -dc";            # unlzip to stdout
 $xzcat="xz -dc";              # unxz to stdout
 $file="file";                 # "file" command
 $TZ='GMT';                    # default timezone (for Date module)
@@ -186,6 +187,8 @@ if (/gzip/) {
     exit 1 unless (open IN, "$bzcat $mbox_qname|");
 } elsif (/lzma/) {
     exit 1 unless (open IN, "$lzcat $mbox_qname|");
+} elsif (/lz/) {
+    exit 1 unless (open IN, "$lzkat $mbox_qname|");
 } elsif (/xz/) {
     exit 1 unless (open IN, "$xzcat $mbox_qname|");
 } else {
diff -Purp mc-4.7.0.4/lib/vfs/mc-vfs/extfs/patchfs.in 
mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/patchfs.in
--- mc-4.7.0.4/lib/vfs/mc-vfs/extfs/patchfs.in  2010-03-23 13:36:04.000000000 
+0000
+++ mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/patchfs.in      2010-04-29 
11:40:53.000000000 +0000
@@ -17,6 +17,7 @@ my $lzma = 'lzma';
 my $xz   = 'xz';
 my $bzip = 'bzip2';
 my $gzip = 'gzip';
+my $lzip = 'lzip';
 my $fileutil = 'file -b';
 
 # date parsing requires Date::Parse from TimeDate module
@@ -78,6 +79,8 @@ sub myin
        return "$lzma -dc $qfname";
     } elsif (/^'*xz/) {
        return "$xz -dc $qfname";
+    } elsif (/^'*lz/) {
+       return "$lzip -dc $qfname";
     } elsif (/^'*bzip/) {
        return "$bzip -dc $qfname";
     } elsif (/^'*gzip/) {
@@ -98,6 +101,8 @@ sub myout
        return "$lzma -c $sep $qfname";
     } elsif (/^'*xz/) {
        return "$xz -c $sep $qfname";
+    } elsif (/^'*lz/) {
+       return "$lzip -c $sep $qfname";
     } elsif (/^'*bzip/) {
        return "$bzip -c $sep $qfname";
     } elsif (/^'*gzip/) {
diff -Purp mc-4.7.0.4/lib/vfs/mc-vfs/extfs/sfs.ini 
mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/sfs.ini
--- mc-4.7.0.4/lib/vfs/mc-vfs/extfs/sfs.ini     2010-03-23 13:36:04.000000000 
+0000
+++ mc-4.7.0.4-rhs/lib/vfs/mc-vfs/extfs/sfs.ini 2010-04-29 11:42:08.000000000 
+0000
@@ -12,6 +12,8 @@ bz2/1 bzip2 < %1 > %3
 ubz2/1 bzip2 -d < %1 > %3
 lzma/1 lzma < %1 > %3
 ulzma/1        lzma -d < %1 > %3
+lzip/1 lzip < %1 > %3
+ulzip/1        lzip -d < %1 > %3
 xz/1   xz < %1 > %3
 uxz/1  xz -d < %1 > %3
 tar/1  tar cf %3 %1
diff -Purp mc-4.7.0.4/misc/mc.ext.in mc-4.7.0.4-rhs/misc/mc.ext.in
--- mc-4.7.0.4/misc/mc.ext.in   2010-03-30 06:43:18.000000000 +0000
+++ mc-4.7.0.4-rhs/misc/mc.ext.in       2010-04-29 11:11:24.000000000 +0000
@@ -106,8 +106,8 @@
 
 ### Archives ###
 
-# .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk
-regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk$
+# .taz, .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk
+regex/\.t([agp]?z|ar\.g?[zZ])$|\.ipk$
        Open=%cd %p#utar
        View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
 
@@ -119,6 +119,11 @@ regex/\.t(ar\.bz2|bz2?|b2)$
        Open=%cd %p#utar
        View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf -
 
+# .tar.lz
+shell/.tar.lz
+       Open=%cd %p#utar
+       View=%view{ascii} lzip -dc %f 2>/dev/null | tar tvvf -
+
 # .tar.lzma, .tlz
 regex/\.t(ar\.lzma|lz)$
        Open=%cd %p#utar
@@ -298,7 +303,7 @@ shell/.info
 regex/\.(so|so\.[0-9\.]*)$
        View=%view{ascii} file %f && nm %f
 
-regex/(([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])|\.man)$
+regex/(([^0-9]|^[^\.]*)\.([0-9][A-Za-z]*|[ln])|\.man)$
        Open=case %d/%f in */log/*|*/logs/*) cat %f ;; *) { zsoelim %f 
2>/dev/null || cat %f; } | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
        View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) cat %f ;; *) { 
zsoelim %f 2>/dev/null || cat %f; } | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
 
@@ -323,23 +328,27 @@ shell/.ms
        View=%view{ascii,nroff} nroff @MAN_FLAGS@ -ms %f
 
 # Manual page - compressed
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.g?[Zz]$
+regex/([^0-9]|^[^\.]*)\.([0-9][A-Za-z]*|[ln])\.g?[Zz]$
        Open=case %d/%f in */log/*|*/logs/*) gzip -dc %f ;; *) gzip -dc %f | 
nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
        View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) gzip -dc %f ;; 
*) gzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz$
+regex/([^0-9]|^[^\.]*)\.([0-9][A-Za-z]*|[ln])\.bz$
        Open=case %d/%f in */log/*|*/logs/*) bzip -dc %f ;; *) bzip -dc %f | 
nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
        View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) bzip -dc %f ;; 
*) bzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz2$
+regex/([^0-9]|^[^\.]*)\.([0-9][A-Za-z]*|[ln])\.bz2$
        Open=case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;; *) bzip2 -dc %f | 
nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
        View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;; 
*) bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lzma$
+regex/([^0-9]|^[^\.]*)\.([0-9][A-Za-z]*|[ln])\.lz$
+       Open=case %d/%f in */log/*|*/logs/*) lzip -dc %f ;; *) lzip -dc %f | 
nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
+       View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) lzip -dc %f ;; 
*) lzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
+
+regex/([^0-9]|^[^\.]*)\.([0-9][A-Za-z]*|[ln])\.lzma$
        Open=case %d/%f in */log/*|*/logs/*) lzma -dc %f ;; *) lzma -dc %f | 
nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
        View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) lzma -dc %f ;; 
*) lzma -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
 
-regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.xz$
+regex/([^0-9]|^[^\.]*)\.([0-9][A-Za-z]*|[ln])\.xz$
        Open=case %d/%f in */log/*|*/logs/*) xz -dc %f ;; *) xz -dc %f | nroff 
@MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
        View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) xz -dc %f ;; *) 
xz -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
 
@@ -643,6 +652,11 @@ type/^compress
        Open=gzip -dc %f | %var{PAGER:more}
        View=%view{ascii} gzip -dc %f 2>/dev/null
 
+# lzip
+regex/\.lz$
+       Open=lzip -dc %f | %var{PAGER:more}
+       View=%view{ascii} lzip -dc %f 2>/dev/null
+
 # lzma
 regex/\.lzma$
        Open=lzma -dc %f | %var{PAGER:more}
diff -Purp mc-4.7.0.4/src/editor/edit.c mc-4.7.0.4-rhs/src/editor/edit.c
--- mc-4.7.0.4/src/editor/edit.c        2010-04-02 07:02:20.000000000 +0000
+++ mc-4.7.0.4-rhs/src/editor/edit.c    2010-04-29 10:52:06.000000000 +0000
@@ -329,6 +329,7 @@ static const struct edit_filters {
     const char *read, *write, *extension;
 } all_filters[] = {
     { "xz -cd %s 2>&1",     "xz > %s",     ".xz" },
+    { "lzip -cd %s 2>&1",   "lzip > %s",   ".lz" },
     { "lzma -cd %s 2>&1",   "lzma > %s",   ".lzma" },
     { "bzip2 -cd %s 2>&1",  "bzip2 > %s",  ".bz2" },
     { "gzip -cd %s 2>&1",   "gzip > %s",   ".gz"  },
#! /bin/sh

#
# LHa Virtual filesystem executive v0.1
# Copyright (C) 1996, 1997 Joseph M. Hinkle
# May be distributed under the terms of the GNU Public License
# <jhin...@rockisland.com>
#

# Code for mc_lha_fs_run() suggested by:
# Jan 97        Zdenek Kabelac <k...@informatics.muni.cz>

# Tested with mc 3.5.18 and gawk 3.0.0 on Linux 2.0.0
# Tested with lha v1.01 and lharc v1.02
# Information and sources for other forms of lha/lzh appreciated

# Nota bene:
# There are several compression utilities which produce *.lha files.
# LHArc and LHa in exist several versions, and their listing output varies.
# Another variable is the architecture on which the compressed file was made.
# This program attempts to sort out the variables known to me, but it is likely
# to display an empty panel if it encounters a mystery.
# In that case it will be useful to execute this file from the command line:
# ./lha list Mystery.lha
# to examine the output directly on the console.  The output string must be
# precisely in the format described in the README in this directory.
# Caveat emptor.
# Learn Latin.

# Define your awk
AWK=gawk

# Define which archiver you are using with appropriate options
LHA_LIST="lha lq"
LHA_GET="lha pq"
LHA_PUT="lha aq"

# The 'list' command executive

mc_lha_fs_list()
{
   # List the contents of the archive and sort it out
   $LHA_LIST "$1" | $AWK -v uid=`id -nu` -v gid=`id -ng` '
      # Strip a leading '/' if present in a filepath
      $(NF) ~ /^\// { $(NF) = substr($NF,2) }
      # Print the line this way if there is no permission string
      $1 ~ /^\[.*\]/ {
         if ($6 == "") {
            $6 = $4
            $5 = "00:00"
            $4 = "01-01-1980"
         }
         # Invent a generic permission
         $1 = ($NF ~ /\/$/) ? "drwxr-xr-x":"-rwxr--r--";
         # Print it
         printf "%s 1 %-8s %-8s %-8d %s %s %s %s\n",
                 $1, uid, gid, $2, $4, $5, $6, $7;
         # Get the next line of the list
         next;
      }
      # Do it this way for a defined permission
      $1 !~ /^\[.*\]/ {
         # If the permissions and UID run together
         if ($1 ~ /\//) {
            $8 = $7;
            $7 = $6;
            $6 = $5;
            $5 = $4;
            $3 = $2;
            $2 = substr($1,10);
            $1 = substr($1,1,9);
         }
         # If the permission string is missing a type
         if (length($1) == 9) {
            if ($NF ~ /\/$/)
               $1 = ("d" $1);
            else
               $1 = ("-" $1);
         }
         # UID:GID might not be the same as on your system so print numbers
         # Well, that is the intent.  At the moment mc is translating them.
         split($2, id, "/");
         printf "%s 1 %-8d %-8d %-8d %s %s %s %s\n",
                 $1, id[1], id[2], $3, $5, $6, $7, substr($0, 52);
         # Get the next line of the list
         next;
      }

   '
}

# The 'copyout' command executive to copy displayed files to a destination

mc_lha_fs_copyout()
{
   $LHA_GET "$1" "$2" > "$3"
}

# The 'copyin' command executive to add something to the archive

mc_lha_fs_copyin ()
{
   NAME2=`basename "$2"`; DIR2=${2%$NAME2}
   NAME3=`basename "$3"`; DIR3=${3%$NAME3}

   cd "${DIR3}"

   ONE2=${2%%/*}
   [ -n "${ONE2}" ] || exit 1
   [ -e "${ONE2}" ] && exit 1

   [ -e "${DIR2}" ] || mkdir -p "${DIR2}"
   ln "$3" "$2"     || exit 1

   $LHA_PUT "$1" "$2"
   rm -r "${ONE2}"
}

# The 'run' command executive to run a command from within an archive

mc_lha_fs_run()
{
   TMPDIR=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-ulha.XXXXXX"` || exit 1
   trap "rm -rf \"$TMPDIR\"; exit 0" 1 2 3 4 15
   TMPCMD=$TMPDIR/run
   $LHA_GET "$1" "$2" > $TMPCMD
   chmod a+x "$TMPCMD"
   "$TMPCMD"
   rm -rf "$TMPDIR"
}


# The main routine
umask 077

cmd="$1"
shift

case "$cmd" in
   list)    mc_lha_fs_list    "$@" ;;
   copyout) mc_lha_fs_copyout "$@" ;;
   copyin)  mc_lha_fs_copyin  "$@" ;;
   run)     mc_lha_fs_run     "$@" ;;
   *)       exit 1 ;;
esac

exit 0
_______________________________________________
mc mailing list
http://mail.gnome.org/mailman/listinfo/mc

Reply via email to