forked from Qihoo360/evpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
astyle_format_code.sh
executable file
·38 lines (34 loc) · 1.02 KB
/
astyle_format_code.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
SUBDIRS="evpp evpp/http evpp/httpc evpp/udp test examples/echo/httpecho examples/echo/udpecho examples/echo/tcpecho examples/pingpong/client examples/pingpong/server apps/evmc/test apps/evmc apps/evnsq apps/evnsq/test "
FILETYPES="*.cc *.h"
ASTYLE_BIN="3rdparty/astyle/build/gcc/bin/astyle"
ASTYLE="${ASTYLE_BIN} -A2 -HtUwpj -M80 -c -s4 --pad-header --align-pointer=type "
if test -f ${ASTYLE_BIN}
then
echo "use astyle"
else
tar zxvf 3rdparty/astyle_2.06_linux.tar.gz -C 3rdparty
make -j -C 3rdparty/astyle/build/gcc
if test -f ${ASTYLE_BIN}
then
echo "${ASTYLE_BIN} generated successfully."
else
echo "ERROR: astyle compiled failed!!!"
exit 1
fi
fi
for d in ${SUBDIRS}
do
echo "astyle format subdir: $d "
for t in ${FILETYPES}
do
for file in $d/$t
do
echo ">>>>>>>>>> format file: $file "
if test -f $file
then
${ASTYLE} $file
rm -f ${file}.orig
fi
done
done
done