Ticket #4128: 0001-improve-handling-of-compressed-content-in-mc.ext.patch

File 0001-improve-handling-of-compressed-content-in-mc.ext.patch, 4.8 KB (added by ossi, 21 months ago)
  • misc/mc.ext.in

    From 334135fabcb8a9c13d10ad365b203b790db2fc3d Mon Sep 17 00:00:00 2001
    From: Oswald Buddenhagen <ossi@kde.org>
    Date: Fri, 3 Apr 2009 00:30:50 +0200
    Subject: [PATCH] improve handling of compressed content in mc.ext
    
    call 'file' with -z switch to enable getting the type of compressed files,
    and use that capability extensively.
    
    the /logs?/ hacks in ext.d/text.sh need to remain for the time being, as
    file -z doesn't handle .lz4 files as encapsulated content.
    ---
     misc/mc.ext.in        | 53 +++++++++++++++++--------------------------
     src/filemanager/ext.c |  4 ++--
     2 files changed, 23 insertions(+), 34 deletions(-)
    
    diff --git a/misc/mc.ext.in b/misc/mc.ext.in
    index 0faf24be2..0311baae1 100644
    a b shell/.info 
    361361shell/i/.3gp 
    362362        Include=video 
    363363 
    364 # Manual page 
    365 regex/(([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])|\.man)$ 
    366         Open=@EXTHELPERSDIR@/text.sh open man %var{PAGER:more} 
    367         View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man %var{PAGER:more} 
    368  
    369 # Perl pod page 
    370 shell/.pod 
    371         Open=@EXTHELPERSDIR@/text.sh open pod %var{PAGER:more} 
    372         View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view pod %var{PAGER:more} 
    373  
    374364# Troff with me macros. 
    375365# Exception - "read.me" is not a nroff file. 
    376366shell/read.me 
    shell/.ms 
    387377        View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view nroff.ms %var{PAGER:more} 
    388378 
    389379# Manual page - compressed 
    390 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.g?[Zz]$ 
     380type/^(ASCII )?troff.*gzip compressed 
    391381        Open=@EXTHELPERSDIR@/text.sh open man.gz %var{PAGER:more} 
    392382        View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.gz %var{PAGER:more} 
    393383 
    394 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz$ 
     384type/^(ASCII )?troff.*bzip compressed 
    395385        Open=@EXTHELPERSDIR@/text.sh open man.bz %var{PAGER:more} 
    396386        View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.bz %var{PAGER:more} 
    397387 
    398 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz2$ 
     388type/^(ASCII )?troff.*bzip2 compressed 
    399389        Open=@EXTHELPERSDIR@/text.sh open man.bz2 %var{PAGER:more} 
    400390        View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.bz2 %var{PAGER:more} 
    401391 
     392# Manual page 
     393type/^(ASCII )?troff 
     394        Open=@EXTHELPERSDIR@/text.sh open man %var{PAGER:more} 
     395        View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man %var{PAGER:more} 
     396 
     397# Perl pod page 
     398shell/.pod 
     399        Open=@EXTHELPERSDIR@/text.sh open pod %var{PAGER:more} 
     400        View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view pod %var{PAGER:more} 
     401 
    402402regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz$ 
    403403        Open=@EXTHELPERSDIR@/text.sh open man.lz %var{PAGER:more} 
    404404        View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.lz %var{PAGER:more} 
    shell/i/.zoo 
    761761        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zoo 
    762762 
    763763# gzip 
    764 type/^gzip 
     764type/\(gzip compressed 
    765765        Open=@EXTHELPERSDIR@/archive.sh view gz %var{PAGER:more} 
    766766        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz 
    767767 
    768 regex/\.(gz|Z)$ 
    769         View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz 
    770  
    771768# bzip2 
    772 type/^bzip2 
     769type/\(bzip2 compressed 
    773770        Open=@EXTHELPERSDIR@/archive.sh view bzip2 %var{PAGER:more} 
    774771        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bz2 
    775772 
    776 regex/\.bz2?$ 
    777         View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bz2 
    778  
    779773# bzip 
    780 type/^bzip 
     774type/\(bzip compressed 
    781775        Open=@EXTHELPERSDIR@/archive.sh view bzip %var{PAGER:more} 
    782776        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bzip 
    783777 
    784778# compress 
    785 type/^compress 
     779type/\(compress'd 
    786780        Open=@EXTHELPERSDIR@/archive.sh view gz %var{PAGER:more} 
    787781        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz 
    788782 
    789783# lz 
    790 regex/\.lz$ 
    791         Open=@EXTHELPERSDIR@/archive.sh view lz %var{PAGER:more} 
    792         View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz 
    793  
    794 # lz 
    795 type/^LZIP 
     784type/\(lzip compressed 
    796785        Open=@EXTHELPERSDIR@/archive.sh view lz %var{PAGER:more} 
    797786        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz 
    798787 
    regex/\.lz4$ 
    802791        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz4 
    803792 
    804793# lzma 
    805 regex/\.lzma$ 
     794type/\(LZMA compressed 
    806795        Open=@EXTHELPERSDIR@/archive.sh view lzma %var{PAGER:more} 
    807796        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lzma 
    808797 
    809798# xz 
    810 regex/\.xz$ 
     799type/\(XZ compressed 
    811800        Open=@EXTHELPERSDIR@/archive.sh view xz %var{PAGER:more} 
    812801        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view xz 
    813802 
    814803# zstd 
    815 regex/\.zst$ 
     804type/\(Zstandard compressed 
    816805        Open=@EXTHELPERSDIR@/archive.sh view zst %var{PAGER:more} 
    817806        View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zst 
    818807 
  • src/filemanager/ext.c

    diff --git a/src/filemanager/ext.c b/src/filemanager/ext.c
    index 8b00c0d9e..4e1520050 100644
    a b  
    7171/*** file scope macro definitions ****************************************************************/ 
    7272 
    7373#ifdef FILE_L 
    74 #define FILE_CMD "file -L " 
     74#define FILE_CMD "file -L -z " 
    7575#else 
    76 #define FILE_CMD "file " 
     76#define FILE_CMD "file -z " 
    7777#endif 
    7878 
    7979/*** file scope type declarations ****************************************************************/