Ticket #3940: add Meson syntax highlighting.
[midnight-commander.git] / misc / ext.d / misc.sh.in
blobee36384f2af905b595b8a060dea22fc7225d41fc
1 #!/bin/sh
3 # $1 - action
4 # $2 - type of file
6 action=$1
7 filetype=$2
9 [ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open"
11 do_view_action() {
12 filetype=$1
14 case "${filetype}" in
15 iso9660)
16 isoinfo -d -i "${MC_EXT_FILENAME}" && isoinfo -l -R -J -i "${MC_EXT_FILENAME}"
18 cat)
19 /bin/cat "${MC_EXT_FILENAME}" 2>/dev/null
21 ar)
22 file "${MC_EXT_FILENAME}" && nm -C "${MC_EXT_FILENAME}"
24 lib)
25 gplib -t "${MC_EXT_FILENAME}" | \
26 @PERL@ -e 'while (<>) { @a=split /[\s\t]+/, $_; printf ("%-30s | %10d | %s.%s.%02d | %s\n", $a[0], ($a[1]*1),$a[7], lc($a[4]), $a[5], $a[6]);}'
28 so)
29 file "${MC_EXT_FILENAME}" && nm -C -D "${MC_EXT_FILENAME}"
31 elf)
32 file "${MC_EXT_FILENAME}" && nm -C "${MC_EXT_FILENAME}"
34 dbf)
35 dbview -b "${MC_EXT_FILENAME}"
37 sqlite)
38 sqlite3 "${MC_EXT_FILENAME}" .dump
40 mo)
41 msgunfmt "${MC_EXT_FILENAME}" || \
42 cat "${MC_EXT_FILENAME}"
44 lyx)
45 lyxcat "${MC_EXT_FILENAME}"
47 torrent)
48 ctorrent -x "${MC_EXT_FILENAME}" 2>/dev/null
50 javaclass)
51 jad -p "${MC_EXT_FILENAME}" 2>/dev/null || \
52 (file -b "${MC_EXT_FILENAME}"; javap -private "${MC_EXT_FILENAME}" 2>/dev/null)
56 esac
59 do_open_action() {
60 filetype=$1
62 case "${filetype}" in
63 dbf)
64 dbview "${MC_EXT_FILENAME}"
66 sqlite)
67 sqlite3 "${MC_EXT_FILENAME}"
69 glade)
70 if glade-3 --version >/dev/null 2>&1; then
71 (glade-3 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
72 else
73 (glade-2 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
76 po)
77 (poedit "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
79 lyx)
80 lyx "${MC_EXT_FILENAME}"
84 esac
87 case "${action}" in
88 view)
89 do_view_action "${filetype}"
91 open)
92 ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
93 do_open_action "${filetype}"
97 esac