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 |
361 | 361 | shell/i/.3gp |
362 | 362 | Include=video |
363 | 363 | |
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 | | |
374 | 364 | # Troff with me macros. |
375 | 365 | # Exception - "read.me" is not a nroff file. |
376 | 366 | shell/read.me |
… |
… |
shell/.ms |
387 | 377 | View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view nroff.ms %var{PAGER:more} |
388 | 378 | |
389 | 379 | # Manual page - compressed |
390 | | regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.g?[Zz]$ |
| 380 | type/^(ASCII )?troff.*gzip compressed |
391 | 381 | Open=@EXTHELPERSDIR@/text.sh open man.gz %var{PAGER:more} |
392 | 382 | View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.gz %var{PAGER:more} |
393 | 383 | |
394 | | regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz$ |
| 384 | type/^(ASCII )?troff.*bzip compressed |
395 | 385 | Open=@EXTHELPERSDIR@/text.sh open man.bz %var{PAGER:more} |
396 | 386 | View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.bz %var{PAGER:more} |
397 | 387 | |
398 | | regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz2$ |
| 388 | type/^(ASCII )?troff.*bzip2 compressed |
399 | 389 | Open=@EXTHELPERSDIR@/text.sh open man.bz2 %var{PAGER:more} |
400 | 390 | View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.bz2 %var{PAGER:more} |
401 | 391 | |
| 392 | # Manual page |
| 393 | type/^(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 |
| 398 | shell/.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 | |
402 | 402 | regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lz$ |
403 | 403 | Open=@EXTHELPERSDIR@/text.sh open man.lz %var{PAGER:more} |
404 | 404 | View=%view{ascii,nroff} @EXTHELPERSDIR@/text.sh view man.lz %var{PAGER:more} |
… |
… |
shell/i/.zoo |
761 | 761 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zoo |
762 | 762 | |
763 | 763 | # gzip |
764 | | type/^gzip |
| 764 | type/\(gzip compressed |
765 | 765 | Open=@EXTHELPERSDIR@/archive.sh view gz %var{PAGER:more} |
766 | 766 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz |
767 | 767 | |
768 | | regex/\.(gz|Z)$ |
769 | | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz |
770 | | |
771 | 768 | # bzip2 |
772 | | type/^bzip2 |
| 769 | type/\(bzip2 compressed |
773 | 770 | Open=@EXTHELPERSDIR@/archive.sh view bzip2 %var{PAGER:more} |
774 | 771 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bz2 |
775 | 772 | |
776 | | regex/\.bz2?$ |
777 | | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bz2 |
778 | | |
779 | 773 | # bzip |
780 | | type/^bzip |
| 774 | type/\(bzip compressed |
781 | 775 | Open=@EXTHELPERSDIR@/archive.sh view bzip %var{PAGER:more} |
782 | 776 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view bzip |
783 | 777 | |
784 | 778 | # compress |
785 | | type/^compress |
| 779 | type/\(compress'd |
786 | 780 | Open=@EXTHELPERSDIR@/archive.sh view gz %var{PAGER:more} |
787 | 781 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view gz |
788 | 782 | |
789 | 783 | # 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 |
| 784 | type/\(lzip compressed |
796 | 785 | Open=@EXTHELPERSDIR@/archive.sh view lz %var{PAGER:more} |
797 | 786 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz |
798 | 787 | |
… |
… |
regex/\.lz4$ |
802 | 791 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lz4 |
803 | 792 | |
804 | 793 | # lzma |
805 | | regex/\.lzma$ |
| 794 | type/\(LZMA compressed |
806 | 795 | Open=@EXTHELPERSDIR@/archive.sh view lzma %var{PAGER:more} |
807 | 796 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view lzma |
808 | 797 | |
809 | 798 | # xz |
810 | | regex/\.xz$ |
| 799 | type/\(XZ compressed |
811 | 800 | Open=@EXTHELPERSDIR@/archive.sh view xz %var{PAGER:more} |
812 | 801 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view xz |
813 | 802 | |
814 | 803 | # zstd |
815 | | regex/\.zst$ |
| 804 | type/\(Zstandard compressed |
816 | 805 | Open=@EXTHELPERSDIR@/archive.sh view zst %var{PAGER:more} |
817 | 806 | View=%view{ascii} @EXTHELPERSDIR@/archive.sh view zst |
818 | 807 | |
diff --git a/src/filemanager/ext.c b/src/filemanager/ext.c
index 8b00c0d9e..4e1520050 100644
a
|
b
|
|
71 | 71 | /*** file scope macro definitions ****************************************************************/ |
72 | 72 | |
73 | 73 | #ifdef FILE_L |
74 | | #define FILE_CMD "file -L " |
| 74 | #define FILE_CMD "file -L -z " |
75 | 75 | #else |
76 | | #define FILE_CMD "file " |
| 76 | #define FILE_CMD "file -z " |
77 | 77 | #endif |
78 | 78 | |
79 | 79 | /*** file scope type declarations ****************************************************************/ |