mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-01 00:54:24 +03:00
Ticket #4127: several improvements to mc.ext and syntax highlighting.
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. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
09473d87f0
commit
31e7a7e963
@ -25,9 +25,9 @@ staroffice_console() {
|
||||
}
|
||||
|
||||
get_ooffice_executable() {
|
||||
if loffice >/dev/null 2>&1; then
|
||||
if which loffice >/dev/null 2>&1; then
|
||||
echo "loffice"
|
||||
elif ooffice >/dev/null 2>&1; then
|
||||
elif which ooffice >/dev/null 2>&1; then
|
||||
echo "ooffice"
|
||||
else
|
||||
echo -n
|
||||
@ -52,28 +52,28 @@ do_view_action() {
|
||||
fi
|
||||
;;
|
||||
msdoc)
|
||||
if wvHtml >/dev/null 2>&1; then
|
||||
if which 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"
|
||||
elif antiword >/dev/null 2>&1; then
|
||||
elif which antiword >/dev/null 2>&1; then
|
||||
antiword -t "${MC_EXT_FILENAME}"
|
||||
elif catdoc >/dev/null 2>&1; then
|
||||
elif which catdoc >/dev/null 2>&1; then
|
||||
catdoc -w "${MC_EXT_FILENAME}"
|
||||
elif word2x >/dev/null 2>&1; then
|
||||
elif which word2x >/dev/null 2>&1; then
|
||||
word2x -f text "${MC_EXT_FILENAME}" -
|
||||
else
|
||||
strings "${MC_EXT_FILENAME}"
|
||||
fi
|
||||
;;
|
||||
msxls)
|
||||
if xlhtml >/dev/null 2>&1; then
|
||||
if which 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"
|
||||
elif xls2csv >/dev/null 2>&1; then
|
||||
elif which xls2csv >/dev/null 2>&1; then
|
||||
xls2csv "${MC_EXT_FILENAME}"
|
||||
else
|
||||
strings "${MC_EXT_FILENAME}"
|
||||
|
@ -45,7 +45,7 @@ do_open_action() {
|
||||
else
|
||||
(gqview "${MC_EXT_FILENAME}" &)
|
||||
fi
|
||||
elif see >/dev/null 2>&1; then
|
||||
elif which see >/dev/null 2>&1; then
|
||||
(see "${MC_EXT_FILENAME}" &)
|
||||
else
|
||||
(zgv "${MC_EXT_FILENAME}" &)
|
||||
|
@ -71,7 +71,7 @@ do_open_action() {
|
||||
sqlite3 "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
glade)
|
||||
if glade-3 --version >/dev/null 2>&1; then
|
||||
if which glade-3 >/dev/null 2>&1; then
|
||||
(glade-3 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
else
|
||||
(glade-2 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
|
@ -13,7 +13,7 @@ do_view_action() {
|
||||
|
||||
case "${filetype}" in
|
||||
*)
|
||||
if mplayer >/dev/null 2>&1; then
|
||||
if which mplayer >/dev/null 2>&1; then
|
||||
mplayer -identify -vo null -ao null -frames 0 "${MC_EXT_FILENAME}" 2>&1 | \
|
||||
sed -n 's/^ID_//p'
|
||||
elif which mpv_identify.sh >/dev/null 2>&1; then
|
||||
@ -28,9 +28,9 @@ do_view_action() {
|
||||
do_open_action() {
|
||||
filetype=$1
|
||||
|
||||
if mpv >/dev/null 2>&1; then
|
||||
if which mpv >/dev/null 2>&1; then
|
||||
PLAYER=mpv
|
||||
elif mplayer >/dev/null 2>&1; then
|
||||
elif which mplayer >/dev/null 2>&1; then
|
||||
PLAYER=mplayer
|
||||
else
|
||||
echo "Please install either mplayer or mpv to play this file"
|
||||
|
Loading…
Reference in New Issue
Block a user