Ticket #2103: mc.ext.in.2.patch

File mc.ext.in.2.patch, 7.4 KB (added by gotar, 14 years ago)
  • mc.ext.in

    diff -urN misc/mc.ext.in misc.new/mc.ext.in
    old new  
    345345 
    346346# CHM 
    347347regex/\.(chm|CHM)$ 
    348         Open=which kchmviewer > /dev/null 2>&1 && (kchmviewer %f &) || (xchm %f &) 
     348        Open=if [ -n "$DISPLAY" ]; then which kchmviewer > /dev/null 2>&1 && (kchmviewer %f &) || (xchm %f &); else chm_http %f & elinks http://localhost:8080/index.html; kill -INT %%1; fi 
    349349 
    350350### Images ### 
    351351 
     
    391391        Include=image 
    392392 
    393393include/image 
    394         Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (gqview %f &); fi 
     394        Open=if [ -z "$DISPLAY" ]; then zgv %f; else (gqview %f &); fi 
    395395        View=%view{ascii} identify %f 
    396396        #View=%view{ascii} asciiview %f 
    397397 
    398  
    399398### Sound files ### 
    400399 
    401400regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$ 
    402        Open=if [ "$DISPLAY" = "" ]; then play %f; else (xmms %f >/dev/null 2>&1 &); fi 
     401       Open=if [ -z "$DISPLAY" ]; then play %f; else (xmms %f >/dev/null 2>&1 &); fi 
    403402 
    404403regex/\.([mM][oO][dD]|[sS]3[mM]|[xX][mM]|[iI][tT]|[mM][tT][mM]|669|[sS][tT][mM]|[uU][lL][tT]|[fF][aA][rR])$ 
    405404       Open=mikmod %f 
     
    409408       Open=vplay -s 22 %f 
    410409 
    411410regex/\.([mM][pP]3)$ 
    412         Open=if [ "$DISPLAY" = "" ]; then mpg123 %f; else (xmms %f >/dev/null 2>&1 &); fi 
     411        Open=if [ -z "$DISPLAY" ]; then mpg123 %f; else (xmms %f >/dev/null 2>&1 &); fi 
    413412        View=%view{ascii} mpg123 -vtn1 %f 2>&1 | sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p' 
    414413 
    415414regex/\.([oO][gG][gG|aA|vV|xX])$ 
    416         Open=if [ "$DISPLAY" = "" ]; then ogg123 %f; else (xmms %f >/dev/null 2>&1 &); fi 
     415        Open=if [ -z "$DISPLAY" ]; then ogg123 %f; else (xmms %f >/dev/null 2>&1 &); fi 
    417416        View=%view{ascii} ogginfo %s 
    418417 
    419418regex/\.([sS][pP][xX]|[fF][lL][aA][cC])$ 
    420         Open=if [ "$DISPLAY" = "" ]; then play %f; else (xmms %f >/dev/null 2>&1 &); fi 
     419        Open=if [ -z "$DISPLAY" ]; then play %f; else (xmms %f >/dev/null 2>&1 &); fi 
    421420 
    422421regex/\.([mM][iI][dD][iI]?|[rR][mM][iI][dD]?)$ 
    423422        Open=timidity %f 
     
    469467        Open=(realplay %f >/dev/null 2>&1 &) 
    470468 
    471469include/video 
    472         Open=(mplayer %f >/dev/null 2>&1 &) 
     470        Open=if [ -z "$DISPLAY" ]; then mplayer -vo null %f; else (mplayer %f >/dev/null 2>&1 &); fi 
    473471        #Open=(gtv %f >/dev/null 2>&1 &) 
    474472        #Open=(xanim %f >/dev/null 2>&1 &) 
    475473 
     
    478476 
    479477# Postscript 
    480478type/^PostScript 
    481         Open=(gv %f &) 
     479        Open=if [ -n "$DISPLAY" ]; then (gv %f &); else ps2ascii %f | %var{PAGER:more}; fi 
    482480        View=%view{ascii} ps2ascii %f 
    483481 
    484482# PDF 
    485483type/^PDF 
    486         Open=(xpdf %f &) 
     484        Open=if [ -n "$DISPLAY" ]; then (xpdf %f &); else pdftotext -layout -nopgbrk %f - | %var{PAGER:more}; fi 
    487485        #Open=(acroread %f &) 
    488486        #Open=(ghostview %f &) 
    489         View=%view{ascii} pdftotext %f - 
     487        View=%view{ascii} pdftotext -layout -nopgbrk %f - 
    490488 
    491489# The following code very ugly and should not be taken as example. 
    492490# It should be cleaned up when the new format of mc.ext is developed. 
    493491 
    494492# html 
    495493regex/\.([hH][tT][mM][lL]?)$ 
    496         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 
    497         View=%view{ascii} links -dump %f 2>/dev/null || w3m -dump %f 2>/dev/null || lynx -dump -force_html %f 
     494        Open=(if test -n "@X11_WWW@" && [ -n "$DISPLAY" ]; then (@X11_WWW@ file://%d/%p &) 1>&2; else elinks %f || links %f || lynx -force_html %f || %var{PAGER:more} %f; fi) 2>/dev/null 
     495        View=%view{ascii} elinks -dump %f 2>/dev/null || links -dump %f 2>/dev/null || w3m -dump %f 2>/dev/null || lynx -dump -force_html %f 
    498496 
    499497# StarOffice 5.2 
    500498shell/.sdw 
    501499        Open=(ooffice %f &) 
    502500 
     501regex/\.(sxw|SXW)$ 
     502        Open=if [ -n "$DISPLAY" ]; then (ooffice %f &); else tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; cd $tmp; /usr/bin/soffice2html.pl %d/%f; /usr/bin/elinks content.html; /bin/rm -rf "$tmp"; fi 
     503        View=%view{ascii} tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; cd $tmp; /usr/bin/soffice2html.pl %d/%f; /usr/bin/elinks -dump content.html; rm -rf "$tmp" 
     504 
     505regex/\.(odp|ODP|ods|ODS|odt|ODT)$ 
     506        Open=if [ -n "$DISPLAY" ]; then (ooffice %f &); else odt2txt %f | %var{PAGER:more}; fi 
     507 
    503508# StarOffice 6 and OpenOffice.org formats 
    504509regex/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$ 
    505510        Open=(ooffice %f &) 
     
    511516 
    512517# Microsoft Word Document 
    513518regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$ 
    514         Open=(abiword %f >/dev/null 2>&1 &) 
    515         View=%view{ascii} antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f 
     519        Open=if [ -n "$DISPLAY" ]; then (abiword %f >/dev/null 2>&1 &); else tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/wvHtml %f --targetdir="$tmp" page.html -1; /usr/bin/elinks "$tmp/page.html"; /bin/rm -rf "$tmp"; fi 
     520        View=%view{ascii} tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/wvHtml %f --targetdir="$tmp" page.html; /usr/bin/elinks -dump "$tmp/page.html"; /bin/rm -rf "$tmp" || antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %fantiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f 
    516521type/^Microsoft\ Word 
    517         Open=(abiword %f >/dev/null 2>&1 &) 
    518         View=%view{ascii} antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f 
     522        Open=if [ -n "$DISPLAY" ]; then (abiword %f >/dev/null 2>&1 &); else tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/wvHtml %f --targetdir="$tmp" page.html -1; /usr/bin/elinks "$tmp/page.html"; /bin/rm -rf "$tmp"; fi 
     523        View=%view{ascii} tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/wvHtml %f --targetdir="$tmp" page.html; /usr/bin/elinks -dump "$tmp/page.html"; /bin/rm -rf "$tmp" || antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %fantiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f 
    519524 
    520525# RTF document 
    521526regex/\.([rR][tT][fF])$ 
     
    523528 
    524529# Microsoft Excel Worksheet 
    525530regex/\.([xX][lL][sSwW])$ 
    526         Open=(gnumeric %f >/dev/null 2>&1 &) 
    527         View=%view{ascii} xls2csv %f || strings %f 
     531        Open=if [ -n "$DISPLAY" ]; then (gnumeric %f >/dev/null 2>&1 &); else tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/xlhtml -a %f > "$tmp/page.html"; /usr/bin/elinks "$tmp/page.html"; /bin/rm -rf "$tmp"; fi 
     532        View=%view{ascii} tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/xlhtml -a %f > "$tmp/page.html"; /usr/bin/elinks -dump "$tmp/page.html"; /bin/rm -rf "$tmp" || xls2csv %f || strings %f 
    528533type/^Microsoft\ Excel 
    529         Open=(gnumeric %f >/dev/null 2>&1 &) 
    530         View=%view{ascii} xls2csv %f || strings %f 
     534        Open=if [ -n "$DISPLAY" ]; then (gnumeric %f >/dev/null 2>&1 &); else tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/xlhtml -a %f > "$tmp/page.html"; /usr/bin/elinks "$tmp/page.html"; /bin/rm -rf "$tmp"; fi 
     535        View=%view{ascii} tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/xlhtml -a %f > "$tmp/page.html"; /usr/bin/elinks -dump "$tmp/page.html"; /bin/rm -rf "$tmp" || xls2csv %f || strings %f 
     536 
     537regex/\.(ppt|PPT|pps|PPS)$ 
     538        Open=if [ -n "$DISPLAY" ]; then (ooffice %f >/dev/null 2>&1 &); else tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/ppthtml %f > "$tmp/page.html"; /usr/bin/elinks "$tmp/page.html"; /bin/rm -rf "$tmp"; fi 
     539        View=%view{ascii} tmp=`/bin/mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`; /usr/bin/ppthtml %f > "$tmp/page.html"; /usr/bin/elinks -dump "$tmp/page.html"; /bin/rm -rf "$tmp" 
    531540 
    532541# Use OpenOffice.org to open any MS Office documents 
    533542type/^Microsoft\ Office\ Document 
     
    539548 
    540549# DVI 
    541550regex/\.([dD][vV][iI])$ 
    542         Open=if [ x$DISPLAY = x ]; then dvisvga %f; else (xdvi %f &); fi 
     551        Open=if [ -z "$DISPLAY" ]; then dvisvga %f || dvi2tty %f | %var{PAGER:more}; else (xdvi %f &); fi 
    543552        View=%view{ascii} dvi2tty %f 
    544553 
    545554# TeX