- add lzma vfs support by Lasse Collin

- update extensions patch to use xdg-open
This commit is contained in:
Jindrich Novy 2008-03-07 14:37:40 +00:00
parent 574f612026
commit 0bf1824055
3 changed files with 258 additions and 30 deletions

View File

@ -1,17 +1,7 @@
--- mc/configure.ac.extensions 2006-12-28 06:34:31.000000000 +0100 diff -up mc-4.6.2-pre1/configure.extensions mc-4.6.2-pre1/configure
+++ mc/configure.ac 2007-01-04 15:42:15.000000000 +0100 --- mc-4.6.2-pre1/configure.extensions 2007-09-11 16:33:32.000000000 +0200
@@ -83,7 +83,7 @@ +++ mc-4.6.2-pre1/configure 2008-03-07 14:28:51.000000000 +0100
AC_CHECK_TOOL(AR, ar, ar) @@ -5736,7 +5736,7 @@
dnl Only list browsers here that can be run in background (i.e. with `&')
-AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
+AC_CHECK_PROGS(X11_WWW, [firefox gnome-moz-remote mozilla konqueror opera netscape])
dnl
dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
--- mc/configure.extensions 2006-12-28 06:34:48.000000000 +0100
+++ mc/configure 2007-01-04 15:42:15.000000000 +0100
@@ -7166,7 +7166,7 @@
fi fi
@ -20,9 +10,22 @@
do do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
--- mc/lib/mc.ext.in.extensions 2006-12-28 04:45:29.000000000 +0100 diff -up mc-4.6.2-pre1/lib/mc.ext.in.extensions mc-4.6.2-pre1/lib/mc.ext.in
+++ mc/lib/mc.ext.in 2007-01-04 15:53:33.000000000 +0100 --- mc-4.6.2-pre1/lib/mc.ext.in.extensions 2006-12-28 04:57:01.000000000 +0100
@@ -220,14 +220,25 @@ +++ mc-4.6.2-pre1/lib/mc.ext.in 2008-03-07 14:28:31.000000000 +0100
@@ -119,6 +119,11 @@
Open=%cd %p#utar
View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf -
+# .tar.lzma, .tlz
+regex/\.t(ar\.lzma|lz)$
+ Open=%cd %p#utar
+ View=%view{ascii} lzma -dc %f 2>/dev/null | tar tvvf -
+
# .tar.F - used in QNX
regex/\.tar\.F$
# Open=%cd %p#utar
@@ -220,14 +225,25 @@
# C # C
shell/.c shell/.c
@ -35,7 +38,8 @@
+ Include=editor + Include=editor
# Header # Header
regex/\.(h|hpp)$ -regex/\.(h|hpp)$
+regex/\.([Hh]|[Hh]pp|HPP)$
+ Include=editor + Include=editor
+ +
+# Asm +# Asm
@ -50,7 +54,7 @@
Open=%var{EDITOR:vi} %f Open=%var{EDITOR:vi} %f
# Object # Object
@@ -251,10 +262,12 @@ @@ -251,10 +267,12 @@
# GNU Info page # GNU Info page
type/^Info\ text type/^Info\ text
@ -65,7 +69,18 @@
# Manual page # Manual page
# Exception - .so libraries are not manual pages # Exception - .so libraries are not manual pages
@@ -328,18 +341,24 @@ @@ -298,6 +316,10 @@
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$
+ 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
+
### Images ###
@@ -328,18 +350,24 @@
type/^Netpbm type/^Netpbm
Include=image Include=image
@ -88,11 +103,11 @@
include/image include/image
- Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (gqview %f &); fi - Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (gqview %f &); fi
+ Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (display %f &); fi + Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (xdg-open %f &); fi
View=%view{ascii} identify %f View=%view{ascii} identify %f
#View=%view{ascii} asciiview %f #View=%view{ascii} asciiview %f
@@ -347,7 +366,8 @@ @@ -347,7 +375,8 @@
### Sound files ### ### Sound files ###
regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$ regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$
@ -102,7 +117,7 @@
regex/\.([mM][oO][dD]|[sS]3[mM]|[xX][mM]|[iI][tT]|[mM][tT][mM]|669|[sS][tT][mM]|[uU][lL][tT]|[fF][aA][rR])$ regex/\.([mM][oO][dD]|[sS]3[mM]|[xX][mM]|[iI][tT]|[mM][tT][mM]|669|[sS][tT][mM]|[uU][lL][tT]|[fF][aA][rR])$
Open=mikmod %f Open=mikmod %f
@@ -357,11 +377,16 @@ @@ -357,11 +386,16 @@
Open=vplay -s 22 %f Open=vplay -s 22 %f
regex/\.([mM][pP]3)$ regex/\.([mM][pP]3)$
@ -122,7 +137,7 @@
View=%view{ascii} ogginfo %s View=%view{ascii} ogginfo %s
regex/\.([mM][iI][dD][iI]?|[rR][mM][iI][dD]?)$ regex/\.([mM][iI][dD][iI]?|[rR][mM][iI][dD]?)$
@@ -371,11 +396,15 @@ @@ -371,11 +405,15 @@
Open=mplayer -vo null %f Open=mplayer -vo null %f
View=%view{ascii} mplayer -quiet -slave -frames 0 -vo null -ao null -identify %f 2>/dev/null | tail +13 || file %f View=%view{ascii} mplayer -quiet -slave -frames 0 -vo null -ao null -identify %f 2>/dev/null | tail +13 || file %f
@ -139,7 +154,7 @@
### Video ### ### Video ###
@@ -395,20 +424,27 @@ @@ -395,20 +433,27 @@
regex/\.([mM][pP]4|[mM][pP][eE]?[gG])$ regex/\.([mM][pP]4|[mM][pP][eE]?[gG])$
Include=video Include=video
@ -168,7 +183,7 @@
#Open=(gtv %f >/dev/null 2>&1 &) #Open=(gtv %f >/dev/null 2>&1 &)
#Open=(xanim %f >/dev/null 2>&1 &) #Open=(xanim %f >/dev/null 2>&1 &)
@@ -417,12 +453,13 @@ @@ -417,12 +462,13 @@
# Postscript # Postscript
type/^PostScript type/^PostScript
@ -179,12 +194,12 @@
# PDF # PDF
type/^PDF type/^PDF
- Open=(xpdf %f &) - Open=(xpdf %f &)
+ Open=(evince %f >/dev/null 2>&1 &) + Open=(xdg-open %f >/dev/null 2>&1 &)
+ #Open=(xpdf %f >/dev/null 2>&1 &) + #Open=(xpdf %f >/dev/null 2>&1 &)
#Open=(acroread %f &) #Open=(acroread %f &)
#Open=(ghostview %f &) #Open=(ghostview %f &)
View=%view{ascii} pdftotext %f - View=%view{ascii} pdftotext %f -
@@ -433,7 +470,7 @@ @@ -433,7 +479,7 @@
# html # html
regex/\.([hH][tT][mM][lL]?)$ regex/\.([hH][tT][mM][lL]?)$
Open=(if test -n "@X11_WWW@" && test -n "$DISPLAY"; then (@X11_WWW@ file://%d/%p &) 1>&2; else links %f || lynx -force_html %f || ${PAGER:-more} %f; fi) 2>/dev/null Open=(if test -n "@X11_WWW@" && test -n "$DISPLAY"; then (@X11_WWW@ file://%d/%p &) 1>&2; else links %f || lynx -force_html %f || ${PAGER:-more} %f; fi) 2>/dev/null
@ -193,7 +208,7 @@
# StarOffice 5.2 # StarOffice 5.2
shell/.sdw shell/.sdw
@@ -450,22 +487,27 @@ @@ -450,22 +496,27 @@
# Microsoft Word Document # Microsoft Word Document
regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$ regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$
@ -226,3 +241,27 @@
View=%view{ascii} xls2csv %f || strings %f View=%view{ascii} xls2csv %f || strings %f
# Use OpenOffice.org to open any MS Office documents # Use OpenOffice.org to open any MS Office documents
@@ -542,6 +593,11 @@
Open=gzip -dc %f | %var{PAGER:more}
View=%view{ascii} gzip -dc %f 2>/dev/null
+# lzma
+regex/\.lzma$
+ Open=lzma -dc %f | %var{PAGER:more}
+ View=%view{ascii} lzma -dc %f 2>/dev/null
+
### Default ###
diff -up mc-4.6.2-pre1/configure.ac.extensions mc-4.6.2-pre1/configure.ac
--- mc-4.6.2-pre1/configure.ac.extensions 2007-09-10 16:25:30.000000000 +0200
+++ mc-4.6.2-pre1/configure.ac 2008-03-07 14:28:51.000000000 +0100
@@ -83,7 +83,7 @@
AC_CHECK_TOOL(AR, ar, ar)
dnl Only list browsers here that can be run in background (i.e. with `&')
-AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
+AC_CHECK_PROGS(X11_WWW, [firefox gnome-moz-remote mozilla konqueror opera netscape])
dnl
dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.

183
mc-lzma.patch Normal file
View File

@ -0,0 +1,183 @@
# LZMA support for Midnight Commander
# 2006-03-17
#
# This patch adds basic support for LZMA compressed files to
# Midnight Commander 4.6.1. You should have LZMA utils 4.32.x
# or later. Older versions of LZMA utils will *not* work.
#
# Copyright (C) 2006 Lasse Collin <lasse.collin@tukaani.org>
#
# This patch is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
diff -Naru mc-4.6.1.orig/edit/edit.c mc-4.6.1/edit/edit.c
--- mc-4.6.1.orig/edit/edit.c 2005-05-27 17:19:18.000000000 +0300
+++ mc-4.6.1/edit/edit.c 2006-03-17 17:39:49.000000000 +0200
@@ -186,6 +186,7 @@
static const struct edit_filters {
const char *read, *write, *extension;
} all_filters[] = {
+ { "lzma -cd %s 2>&1", "lzma > %s", ".bz2" },
{ "bzip2 -cd %s 2>&1", "bzip2 > %s", ".bz2" },
{ "gzip -cd %s 2>&1", "gzip > %s", ".gz" },
{ "gzip -cd %s 2>&1", "gzip > %s", ".Z" }
diff -Naru mc-4.6.1.orig/src/util.c mc-4.6.1/src/util.c
--- mc-4.6.1.orig/src/util.c 2005-05-27 17:19:18.000000000 +0300
+++ mc-4.6.1/src/util.c 2006-03-17 18:20:50.000000000 +0200
@@ -900,7 +900,7 @@
* Warning: this function moves the current file pointer */
int get_compression_type (int fd)
{
- unsigned char magic[4];
+ unsigned char magic[16];
/* Read the magic signature */
if (mc_read (fd, (char *) magic, 4) != 4)
@@ -944,6 +944,31 @@
return COMPRESSION_BZIP2;
}
}
+
+ /* LZMA files; both LZMA_Alone and LZMA utils formats. The LZMA_Alone
+ * format is used by the LZMA_Alone tool from LZMA SDK. The LZMA utils
+ * format is the default format of LZMA utils 4.32.1 and later. */
+ if (magic[0] < 0xE1 || (magic[0] == 0xFF && magic[1] == 'L' &&
+ magic[2] == 'Z' && magic[3] == 'M')) {
+ if (mc_read (fd, (char *) magic + 4, 9) == 9) {
+ /* LZMA utils format */
+ if (magic[0] == 0xFF && magic[4] == 'A' && magic[5] == 0x00)
+ return COMPRESSION_LZMA;
+ /* The LZMA_Alone format has no magic bytes, thus we
+ * need to play a wizard. This can give false positives,
+ * thus the detection below should be removed when
+ * the newer LZMA utils format has got popular. */
+ if (magic[0] < 0xE1 && magic[4] < 0x20 &&
+ ((magic[10] == 0x00 && magic[11] == 0x00 &&
+ magic[12] == 0x00) ||
+ (magic[5] == 0xFF && magic[6] == 0xFF &&
+ magic[7] == 0xFF && magic[8] == 0xFF &&
+ magic[9] == 0xFF && magic[10] == 0xFF &&
+ magic[11] == 0xFF && magic[12] == 0xFF)))
+ return COMPRESSION_LZMA;
+ }
+ }
+
return 0;
}
@@ -954,6 +979,7 @@
case COMPRESSION_GZIP: return "#ugz";
case COMPRESSION_BZIP: return "#ubz";
case COMPRESSION_BZIP2: return "#ubz2";
+ case COMPRESSION_LZMA: return "#ulzma";
}
/* Should never reach this place */
fprintf (stderr, "Fatal: decompress_extension called with an unknown argument\n");
diff -Naru mc-4.6.1.orig/src/util.h mc-4.6.1/src/util.h
--- mc-4.6.1.orig/src/util.h 2005-01-13 21:20:47.000000000 +0200
+++ mc-4.6.1/src/util.h 2006-03-17 17:34:34.000000000 +0200
@@ -169,7 +169,8 @@
COMPRESSION_NONE,
COMPRESSION_GZIP,
COMPRESSION_BZIP,
- COMPRESSION_BZIP2
+ COMPRESSION_BZIP2,
+ COMPRESSION_LZMA
};
int get_compression_type (int fd);
diff -Naru mc-4.6.1.orig/vfs/extfs/iso9660.in mc-4.6.1/vfs/extfs/iso9660.in
--- mc-4.6.1.orig/vfs/extfs/iso9660.in 2004-10-29 12:14:38.000000000 +0300
+++ mc-4.6.1/vfs/extfs/iso9660.in 2006-03-17 17:45:28.000000000 +0200
@@ -25,6 +25,7 @@
mcisofs_list () {
# left as a reminder to implement compressed image support =)
case "$1" in
+ *.lzma) MYCAT="lzma -dc";;
*.bz2) MYCAT="bzip2 -dc";;
*.gz) MYCAT="gzip -dc";;
*.z) MYCAT="gzip -dc";;
diff -Naru mc-4.6.1.orig/vfs/extfs/lslR.in mc-4.6.1/vfs/extfs/lslR.in
--- mc-4.6.1.orig/vfs/extfs/lslR.in 2003-06-22 12:54:21.000000000 +0300
+++ mc-4.6.1/vfs/extfs/lslR.in 2006-03-17 17:45:08.000000000 +0200
@@ -12,6 +12,7 @@
mclslRfs_list () {
case "$1" in
+ *.lzma) MYCAT="lzma -dc";;
*.bz2) MYCAT="bzip2 -dc";;
*.gz) MYCAT="gzip -dc";;
*.z) MYCAT="gzip -dc";;
diff -Naru mc-4.6.1.orig/vfs/extfs/mailfs.in mc-4.6.1/vfs/extfs/mailfs.in
--- mc-4.6.1.orig/vfs/extfs/mailfs.in 2002-12-24 08:56:17.000000000 +0200
+++ mc-4.6.1/vfs/extfs/mailfs.in 2006-03-17 17:53:47.000000000 +0200
@@ -7,6 +7,7 @@
$zcat="zcat"; # gunzip to stdout
$bzcat="bzip2 -dc"; # bunzip2 to stdout
+$lzcat="lzma -dc"; # unlzma to stdout
$file="file"; # "file" command
$TZ='GMT'; # default timezone (for Date module)
@@ -132,6 +133,8 @@
exit 1 unless (open IN, "$zcat $mbox_qname|");
} elsif (/bzip/) {
exit 1 unless (open IN, "$bzcat $mbox_qname|");
+} elsif (/lzma/) {
+ exit 1 unless (open IN, "$lzcat $mbox_qname|");
} else {
exit 1 unless (open IN, "<$mbox_name");
}
diff -Naru mc-4.6.1.orig/vfs/extfs/patchfs.in mc-4.6.1/vfs/extfs/patchfs.in
--- mc-4.6.1.orig/vfs/extfs/patchfs.in 2004-11-17 01:00:40.000000000 +0200
+++ mc-4.6.1/vfs/extfs/patchfs.in 2006-03-17 17:52:47.000000000 +0200
@@ -12,6 +12,7 @@
use File::Temp 'tempfile';
# standard binaries
+my $lzma = 'lzma';
my $bzip = 'bzip2';
my $gzip = 'gzip';
my $fileutil = 'file';
@@ -70,7 +71,9 @@
my ($qfname)=(quotemeta $_[0]);
$_=`$fileutil $qfname`;
- if (/bzip/) {
+ if (/lzma/) {
+ return "$lzma -dc $qfname";
+ } elsif (/bzip/) {
return "$bzip -dc $qfname";
} elsif (/gzip/) {
return "$gzip -dc $qfname";
@@ -86,7 +89,9 @@
my ($sep) = $append ? '>>' : '>';
$_=`$fileutil $qfname`;
- if (/bzip/) {
+ if (/lzma/) {
+ return "$lzma -c $sep $qfname";
+ } elsif (/bzip/) {
return "$bzip -c $sep $qfname";
} elsif (/gzip/) {
return "$gzip -c $sep $qfname";
diff -Naru mc-4.6.1.orig/vfs/extfs/sfs.ini mc-4.6.1/vfs/extfs/sfs.ini
--- mc-4.6.1.orig/vfs/extfs/sfs.ini 1998-12-15 17:57:43.000000000 +0200
+++ mc-4.6.1/vfs/extfs/sfs.ini 2006-03-17 17:44:01.000000000 +0200
@@ -10,6 +10,8 @@
ubz/1 bzip -d < %1 > %3
bz2/1 bzip2 < %1 > %3
ubz2/1 bzip2 -d < %1 > %3
+lzma/1 lzma < %1 > %3
+ulzma/1 lzma -d < %1 > %3
tar/1 tar cf %3 %1
tgz/1 tar czf %3 %1
uhtml/1 lynx -force_html -dump %1 > %3

View File

@ -1,7 +1,7 @@
Summary: User-friendly text console file manager and visual shell Summary: User-friendly text console file manager and visual shell
Name: mc Name: mc
Version: 4.6.2 Version: 4.6.2
Release: 1.pre1%{?dist} Release: 2.pre1%{?dist}
Epoch: 1 Epoch: 1
License: GPLv2 License: GPLv2
Group: System Environment/Shells Group: System Environment/Shells
@ -29,6 +29,7 @@ Patch14: mc-cloexec.patch
Patch15: mc-prompt.patch Patch15: mc-prompt.patch
Patch16: mc-refresh.patch Patch16: mc-refresh.patch
Patch17: mc-preserveattr.patch Patch17: mc-preserveattr.patch
Patch18: mc-lzma.patch
%description %description
Midnight Commander is a visual shell much like a file manager, only Midnight Commander is a visual shell much like a file manager, only
@ -57,6 +58,7 @@ specific files.
%patch15 -p1 -b .prompt %patch15 -p1 -b .prompt
%patch16 -p1 -b .refresh %patch16 -p1 -b .refresh
%patch17 -p1 -b .preserveattr %patch17 -p1 -b .preserveattr
%patch18 -p1 -b .lzmavfs
# convert files in /lib to UTF-8 # convert files in /lib to UTF-8
pushd lib pushd lib
@ -195,6 +197,10 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_libexecdir}/mc %dir %{_libexecdir}/mc
%changelog %changelog
* Fri Mar 7 2008 Jindrich Novy <jnovy@redhat.com> 4.6.2-2.pre1
- add lzma vfs support by Lasse Collin
- update extensions patch to use xdg-open
* Mon Feb 25 2008 Jindrich Novy <jnovy@redhat.com> 4.6.2-1.pre1 * Mon Feb 25 2008 Jindrich Novy <jnovy@redhat.com> 4.6.2-1.pre1
- update to 4.6.2-pre1 - update to 4.6.2-pre1
- forwardport the UTF-8 patch to 4.6.2-pre1 and convert new - forwardport the UTF-8 patch to 4.6.2-pre1 and convert new