Ticket #4128: 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.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Oswald Buddenhagen 2009-04-03 00:30:50 +02:00 committed by Andrew Borodin
parent 723208aeab
commit 8857423e4e
2 changed files with 23 additions and 34 deletions

View File

@ -361,16 +361,6 @@ shell/.info
shell/i/.3gp shell/i/.3gp
Include=video Include=video
# Manual page
regex/(([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])|\.man)$
Open=@EXTHELPERSDIR@/text.sh open man %var{PAGER:more}
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man %var{PAGER:more}
# Perl pod page
shell/.pod
Open=@EXTHELPERSDIR@/text.sh open pod %var{PAGER:more}
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view pod %var{PAGER:more}
# Troff with me macros. # Troff with me macros.
# Exception - "read.me" is not a nroff file. # Exception - "read.me" is not a nroff file.
shell/read.me shell/read.me
@ -387,18 +377,28 @@ shell/.ms
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view nroff.ms %var{PAGER:more} View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view nroff.ms %var{PAGER:more}
# Manual page - compressed # Manual page - compressed
regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.g?[Zz]$ type/^(ASCII )?troff.*gzip compressed
Open=@EXTHELPERSDIR@/text.sh open man.gz %var{PAGER:more} Open=@EXTHELPERSDIR@/text.sh open man.gz %var{PAGER:more}
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.gz %var{PAGER:more} View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.gz %var{PAGER:more}
regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz$ type/^(ASCII )?troff.*bzip compressed
Open=@EXTHELPERSDIR@/text.sh open man.bz %var{PAGER:more} Open=@EXTHELPERSDIR@/text.sh open man.bz %var{PAGER:more}
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.bz %var{PAGER:more} View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.bz %var{PAGER:more}
regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz2$ type/^(ASCII )?troff.*bzip2 compressed
Open=@EXTHELPERSDIR@/text.sh open man.bz2 %var{PAGER:more} Open=@EXTHELPERSDIR@/text.sh open man.bz2 %var{PAGER:more}
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.bz2 %var{PAGER:more} View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.bz2 %var{PAGER:more}
# Manual page
type/^(ASCII )?troff
Open=@EXTHELPERSDIR@/text.sh open man %var{PAGER:more}
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man %var{PAGER:more}
# Perl pod page
shell/.pod
Open=@EXTHELPERSDIR@/text.sh open pod %var{PAGER:more}
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view pod %var{PAGER:more}
regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz$ regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz$
Open=@EXTHELPERSDIR@/text.sh open man.lz %var{PAGER:more} Open=@EXTHELPERSDIR@/text.sh open man.lz %var{PAGER:more}
View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.lz %var{PAGER:more} View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.lz %var{PAGER:more}
@ -761,38 +761,27 @@ shell/i/.zoo
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zoo View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zoo
# gzip # gzip
type/^gzip type/\(gzip compressed
Open=@EXTHELPERSDIR@/archive.sh view gz %var{PAGER:more} Open=@EXTHELPERSDIR@/archive.sh view gz %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz
regex/\.(gz|Z)$
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz
# bzip2 # bzip2
type/^bzip2 type/\(bzip2 compressed
Open=@EXTHELPERSDIR@/archive.sh view bzip2 %var{PAGER:more} Open=@EXTHELPERSDIR@/archive.sh view bzip2 %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bz2 View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bz2
regex/\.bz2?$
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bz2
# bzip # bzip
type/^bzip type/\(bzip compressed
Open=@EXTHELPERSDIR@/archive.sh view bzip %var{PAGER:more} Open=@EXTHELPERSDIR@/archive.sh view bzip %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bzip View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bzip
# compress # compress
type/^compress type/\(compress'd
Open=@EXTHELPERSDIR@/archive.sh view gz %var{PAGER:more} Open=@EXTHELPERSDIR@/archive.sh view gz %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz
# lz # lz
regex/\.lz$ type/\(lzip compressed
Open=@EXTHELPERSDIR@/archive.sh view lz %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz
# lz
type/^LZIP
Open=@EXTHELPERSDIR@/archive.sh view lz %var{PAGER:more} Open=@EXTHELPERSDIR@/archive.sh view lz %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz
@ -802,17 +791,17 @@ regex/\.lz4$
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz4 View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz4
# lzma # lzma
regex/\.lzma$ type/\(LZMA compressed
Open=@EXTHELPERSDIR@/archive.sh view lzma %var{PAGER:more} Open=@EXTHELPERSDIR@/archive.sh view lzma %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lzma View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lzma
# xz # xz
regex/\.xz$ type/\(XZ compressed
Open=@EXTHELPERSDIR@/archive.sh view xz %var{PAGER:more} Open=@EXTHELPERSDIR@/archive.sh view xz %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view xz View=%view{ascii} @EXTHELPERSDIR@/archive.sh view xz
# zstd # zstd
regex/\.zst$ type/\(Zstandard compressed
Open=@EXTHELPERSDIR@/archive.sh view zst %var{PAGER:more} Open=@EXTHELPERSDIR@/archive.sh view zst %var{PAGER:more}
View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zst View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zst

View File

@ -71,9 +71,9 @@
/*** file scope macro definitions ****************************************************************/ /*** file scope macro definitions ****************************************************************/
#ifdef FILE_L #ifdef FILE_L
#define FILE_CMD "file -L " #define FILE_CMD "file -L -z "
#else #else
#define FILE_CMD "file " #define FILE_CMD "file -z "
#endif #endif
/*** file scope type declarations ****************************************************************/ /*** file scope type declarations ****************************************************************/