Code optimization: memory allocation and free moved outside of loop.
[midnight-commander.git] / misc / edit.indent.rc
blob92f82d59503a415efa37aff4c55af84ce73544a3
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
7 exec >/dev/null
9 case `echo $1 |sed 's/^.*\.//'` in
10 c|h)
11 # ftp://ftp.gnu.org/pub/gnu/indent/
12 # Please add options to your ~/.indent.pro, not here.
13 indent "$2"
15 C|cc|CC|cxx|CXX|cpp|CPP)
16 # http://astyle.sourceforge.net/
17 astyle "$2"
19 java|JAVA)
20 # http://astyle.sourceforge.net/
21 astyle --style=java --mode=java "$2"
23 htm|html|HTM|HTML)
24 # http://tidy.sourceforge.net/
25 tidy -q -m -ascii -wrap 80 "$2"
28 # http://www.gnu.org/software/coreutils/
29 fmt "$2" >"$2.tmp" && rm -f "$2" && mv -f "$2.tmp" "$2"
31 esac