使用astyle格式化代码【脚本】

astyle使用基础教程 http://cppblog.com/jokes000/articles/158838.html

steps:

(1) apt-get install astyle 或者去主页http://sourceforge.net/projects/astyle下载

(2) astyl.sh 脚本

dir=`pwd`
filelist=`find $dir -type f -name "*.c" -or -name "*.h"`

for file in $filelist
do
    astyle --style=ansi --indent=spaces=4 $file
done    

(3)把这个脚本放在需要格式化的工程文件夹下,执行即可。

 

其他常用格式:

astyle --style=ansi --indent=tab
posted @ 2016-12-02 11:31  oucaijun  阅读(1052)  评论(0编辑  收藏  举报
下载TeamViewer完整版 下载TeamViewer