Ticket #4127: 0001-add-plenty-of-missing-which-commands-in-ext.d.patch

File 0001-add-plenty-of-missing-which-commands-in-ext.d.patch, 4.1 KB (added by ossi, 23 months ago)
  • misc/ext.d/doc.sh.in

    From d23c1eec3d72183cfeb41e8e5c5bd6c15349ceed Mon Sep 17 00:00:00 2001
    From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
    Date: Thu, 8 Oct 2020 23:59:32 +0200
    Subject: [PATCH 2/5] add plenty of missing 'which' commands in ext.d
    
    the construct 'if <command>' to check the presence of a command would
    work in some cases (though inefficiently), but it others it was just
    bogus. in every case it was inconsistent and confusing.
    ---
     misc/ext.d/doc.sh.in  | 16 ++++++++--------
     misc/ext.d/image.sh   |  2 +-
     misc/ext.d/misc.sh.in |  2 +-
     misc/ext.d/video.sh   |  6 +++---
     4 files changed, 13 insertions(+), 13 deletions(-)
    
    diff --git a/misc/ext.d/doc.sh.in b/misc/ext.d/doc.sh.in
    index 871773c3a..72deae7dd 100644
    a b staroffice_console() { 
    2525} 
    2626 
    2727get_ooffice_executable() { 
    28     if loffice >/dev/null 2>&1; then 
     28    if which loffice >/dev/null 2>&1; then 
    2929        echo "loffice" 
    30     elif ooffice >/dev/null 2>&1; then 
     30    elif which ooffice >/dev/null 2>&1; then 
    3131        echo "ooffice" 
    3232    else 
    3333        echo -n 
    do_view_action() { 
    5252        fi 
    5353        ;; 
    5454    msdoc) 
    55         if wvHtml >/dev/null 2>&1; then 
     55        if which wvHtml >/dev/null 2>&1; then 
    5656            tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX` 
    5757            wvHtml "${MC_EXT_FILENAME}" --targetdir="$tmp" page.html 
    5858            elinks -dump "$tmp/page.html" 
    5959            rm -rf "$tmp" 
    60         elif antiword >/dev/null 2>&1; then 
     60        elif which antiword >/dev/null 2>&1; then 
    6161            antiword -t "${MC_EXT_FILENAME}" 
    62         elif catdoc >/dev/null 2>&1; then 
     62        elif which catdoc >/dev/null 2>&1; then 
    6363            catdoc -w "${MC_EXT_FILENAME}" 
    64         elif word2x >/dev/null 2>&1; then 
     64        elif which word2x >/dev/null 2>&1; then 
    6565            word2x -f text "${MC_EXT_FILENAME}" - 
    6666        else 
    6767            strings "${MC_EXT_FILENAME}" 
    6868        fi 
    6969        ;; 
    7070    msxls) 
    71         if xlhtml >/dev/null 2>&1; then 
     71        if which xlhtml >/dev/null 2>&1; then 
    7272            tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX` 
    7373            xlhtml -a "${MC_EXT_FILENAME}" > "$tmp/page.html" 
    7474            elinks -dump "$tmp/page.html" 
    7575            rm -rf "$tmp" 
    76         elif xls2csv >/dev/null 2>&1; then 
     76        elif which xls2csv >/dev/null 2>&1; then 
    7777            xls2csv "${MC_EXT_FILENAME}" 
    7878        else 
    7979            strings "${MC_EXT_FILENAME}" 
  • misc/ext.d/image.sh

    diff --git a/misc/ext.d/image.sh b/misc/ext.d/image.sh
    index 583c09ecf..04307e01b 100755
    a b do_open_action() { 
    4545            else 
    4646                (gqview "${MC_EXT_FILENAME}" &) 
    4747            fi 
    48         elif see >/dev/null 2>&1; then 
     48        elif which see >/dev/null 2>&1; then 
    4949            (see "${MC_EXT_FILENAME}" &) 
    5050        else 
    5151            (zgv "${MC_EXT_FILENAME}" &) 
  • misc/ext.d/misc.sh.in

    diff --git a/misc/ext.d/misc.sh.in b/misc/ext.d/misc.sh.in
    index f4b0bd47b..32a5f3f8d 100644
    a b do_open_action() { 
    7171        sqlite3 "${MC_EXT_FILENAME}" 
    7272        ;; 
    7373    glade) 
    74         if glade-3 --version >/dev/null 2>&1; then 
     74        if which glade-3 >/dev/null 2>&1; then 
    7575            (glade-3 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &) 
    7676        else 
    7777            (glade-2 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &) 
  • misc/ext.d/video.sh

    diff --git a/misc/ext.d/video.sh b/misc/ext.d/video.sh
    index 979a50acc..9cba21020 100755
    a b do_view_action() { 
    1313 
    1414    case "${filetype}" in 
    1515    *) 
    16         if mplayer >/dev/null 2>&1; then 
     16        if which mplayer >/dev/null 2>&1; then 
    1717            mplayer -identify -vo null -ao null -frames 0 "${MC_EXT_FILENAME}" 2>&1 | \ 
    1818                sed -n 's/^ID_//p' 
    1919        elif which mpv_identify.sh >/dev/null 2>&1; then 
    do_view_action() { 
    2828do_open_action() { 
    2929    filetype=$1 
    3030 
    31     if mpv >/dev/null 2>&1; then 
     31    if which mpv >/dev/null 2>&1; then 
    3232        PLAYER=mpv 
    33     elif mplayer >/dev/null 2>&1; then 
     33    elif which mplayer >/dev/null 2>&1; then 
    3434        PLAYER=mplayer 
    3535    else 
    3636        echo "Please install either mplayer or mpv to play this file"