From 1d197296901f8814df72d47a9e884c5e3a6bbcba Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 21 Jul 2018 18:06:38 +0300 Subject: [PATCH] Ticket #3926: clarify hadling of MS Word and Excel documents view. Don't show error message for each not-installed program when view documents in MS Word and Excel formats. Signed-off-by: Andrew Borodin --- misc/ext.d/doc.sh.in | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/misc/ext.d/doc.sh.in b/misc/ext.d/doc.sh.in index c8e83cfee..1b2293036 100644 --- a/misc/ext.d/doc.sh.in +++ b/misc/ext.d/doc.sh.in @@ -48,27 +48,32 @@ do_view_action() { fi ;; msdoc) - which wvHtml >/dev/null 2>&1 && - { + if wvHtml >/dev/null 2>&1; then tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX` wvHtml "${MC_EXT_FILENAME}" --targetdir="$tmp" page.html elinks -dump "$tmp/page.html" rm -rf "$tmp" - } || \ - antiword -t "${MC_EXT_FILENAME}" || \ - catdoc -w "${MC_EXT_FILENAME}" || \ - word2x -f text "${MC_EXT_FILENAME}" - || \ + elif antiword >/dev/null 2>&1; then + antiword -t "${MC_EXT_FILENAME}" + elif catdoc >/dev/null 2>&1; then + catdoc -w "${MC_EXT_FILENAME}" + elif word2x >/dev/null 2>&1; then + word2x -f text "${MC_EXT_FILENAME}" - + else strings "${MC_EXT_FILENAME}" + fi ;; msxls) - which xlHtml >/dev/null 2>&1 && { + if xlHtml >/dev/null 2>&1; then tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX` xlhtml -a "${MC_EXT_FILENAME}" > "$tmp/page.html" elinks -dump "$tmp/page.html" rm -rf "$tmp" - } || \ - xls2csv "${MC_EXT_FILENAME}" || \ + elif xls2csv >/dev/null 2>&1; then + xls2csv "${MC_EXT_FILENAME}" + else strings "${MC_EXT_FILENAME}" + fi ;; dvi) which dvi2tty >/dev/null 2>&1 && \