Ticket #4271: text.sh.v2.diff

File text.sh.v2.diff, 1.0 KB (added by ZlatkO, 3 years ago)

Patch (variant #2)

  • text.sh

    old new  
    1010 
    1111[ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open" 
    1212 
     13get_awk() { 
     14    if [ -n "${MC_AWK}" ]; then 
     15        echo "${MC_AWK}" 
     16    else 
     17        # awk implementations from https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Programs.html 
     18        # if awk on your system is not one from this list, then set $MC_AWK accordingly 
     19        for local_awk in gawk mawk nawk awk; do 
     20            if which ${local_awk} &> /dev/null; then 
     21                echo "${local_awk}" 
     22                break 
     23            fi 
     24        done 
     25    fi 
     26} 
     27 
    1328get_unpacker() { 
    1429    filetype=$1 
    1530    case "${filetype}" in 
     
    4762 
    4863    unpacker=`get_unpacker ${filetype}` 
    4964 
     65    mc_awk=`get_awk` 
     66    if [ -n "${mc_awk}" ]; then 
     67        ppid_of_ppid=`ps jhp ${PPID} | ${mc_awk} '{print $1}'` 
     68        export MANWIDTH="`stty size < /proc/${ppid_of_ppid}/fd/0 | cut -f2 -d' '`" 
     69    fi 
     70 
    5071    case "${filetype}" in 
    5172    man) 
    5273        case "${MC_EXT_FILENAME}" in