(edit_do_undo): cleanup of labeled statement usage.
[midnight-commander.git] / misc / ext.d / web.sh.in
blobf7531449cf3e8bc8a02bdc996f77a81e57d93d44
1 #!/bin/sh
3 # $1 - action
4 # $2 - type of file
6 action=$1
7 filetype=$2
9 do_view_action() {
10 filetype=$1
12 case "${filetype}" in
13 html)
14 links -dump "${MC_EXT_FILENAME}" 2>/dev/null || \
15 w3m -dump "${MC_EXT_FILENAME}" 2>/dev/null || \
16 lynx -dump -force_html "${MC_EXT_FILENAME}"
20 esac
23 do_open_action() {
24 filetype=$1
26 case "${filetype}" in
27 html)
28 (if [ -n "@X11_WWW@" -a -n "$DISPLAY" ]; then
29 (@X11_WWW@ file://"${MC_EXT_CURRENTDIR}"/"${MC_EXT_BASENAME}" &) 1>&2
30 else
31 elinks "${MC_EXT_FILENAME}" || \
32 links "${MC_EXT_FILENAME}" || \
33 lynx -force_html "${MC_EXT_FILENAME}" || \
34 ${PAGER:-more} "${MC_EXT_FILENAME}"
35 fi) 2>/dev/null
39 esac
42 case "${action}" in
43 view)
44 do_view_action "${filetype}"
46 open)
47 xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \
48 do_open_action "${filetype}"
52 esac