misc.sh.in 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/sh
  2. # $1 - action
  3. # $2 - type of file
  4. action=$1
  5. filetype=$2
  6. do_view_action() {
  7. filetype=$1
  8. filename=$2
  9. case "${filetype}" in
  10. iso9660)
  11. isoinfo -l -i "${MC_EXT_FILENAME}"
  12. ;;
  13. cat)
  14. /bin/cat "${MC_EXT_FILENAME}" 2>/dev/null
  15. ;;
  16. ar)
  17. file "${MC_EXT_FILENAME}" && nm -C "${MC_EXT_FILENAME}"
  18. ;;
  19. lib)
  20. gplib -t "${MC_EXT_FILENAME}" || >&2 | \
  21. @PERL@ -e '@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]);'
  22. ;;
  23. so)
  24. file "${MC_EXT_FILENAME}" && nm -C -D "${MC_EXT_FILENAME}"
  25. ;;
  26. elf)
  27. file "${MC_EXT_FILENAME}" && nm -C "${MC_EXT_FILENAME}"
  28. ;;
  29. dbf)
  30. dbview -b "${MC_EXT_FILENAME}"
  31. ;;
  32. mo)
  33. msgunfmt "${MC_EXT_FILENAME}" || \
  34. cat "${MC_EXT_FILENAME}"
  35. ;;
  36. lyx)
  37. lyxcat "${MC_EXT_FILENAME}"
  38. ;;
  39. torrent)
  40. ctorrent -x "${MC_EXT_FILENAME}" 2>/dev/null
  41. ;;
  42. *)
  43. ;;
  44. esac
  45. }
  46. do_open_action() {
  47. filetype=$1
  48. case "${filetype}" in
  49. imakefile)
  50. xmkmf -a
  51. ;;
  52. dbf)
  53. dbview "${MC_EXT_FILENAME}"
  54. ;;
  55. glade)
  56. if glade-3 --version >/dev/null 2>&1; then
  57. (glade-3 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
  58. else
  59. (glade-2 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
  60. fi
  61. ;;
  62. lyx)
  63. lyx "${MC_EXT_FILENAME}"
  64. ;;
  65. *)
  66. ;;
  67. esac
  68. }
  69. case "${action}" in
  70. view)
  71. do_view_action "${filetype}"
  72. ;;
  73. open)
  74. xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \
  75. do_open_action "${filetype}"
  76. ;;
  77. *)
  78. ;;
  79. esac