misc.sh.in 1.9 KB

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