edit.indent.rc 788 B

12345678910111213141516171819202122232425262728293031
  1. #! /bin/sh
  2. # *** External Formatter (Indenter) for GNU Midnight Commander.
  3. # arguments:
  4. # $1 - Name of the file being edited
  5. # $2 - Name of the file to be processed
  6. exec >/dev/null
  7. case `echo $1 |sed 's/^.*\.//'` in
  8. c|h)
  9. # ftp://ftp.gnu.org/pub/gnu/indent/
  10. # Please add options to your ~/.indent.pro, not here.
  11. indent "$2"
  12. ;;
  13. C|cc|CC|cxx|CXX|cpp|CPP)
  14. # http://astyle.sourceforge.net/
  15. astyle "$2"
  16. ;;
  17. java|JAVA)
  18. # http://astyle.sourceforge.net/
  19. astyle --style=java --mode=java "$2"
  20. ;;
  21. htm|html|HTM|HTML)
  22. # http://tidy.sourceforge.net/
  23. tidy -q -m -ascii -wrap 80 "$2"
  24. ;;
  25. *)
  26. # http://www.gnu.org/software/coreutils/
  27. fmt "$2" >"$2.tmp" && rm -f "$2" && mv -f "$2.tmp" "$2"
  28. ;;
  29. esac