AStyle之linux/windows脚本

来源:互联网 发布:双色球红球7个算法公式 编辑:程序博客网 时间:2024/06/04 00:48

资源下载:http://download.csdn.net/detail/v__king__/9814151

linux如何将AStyle集成到你的c工程

  1. 新建一个AStyle的目录
  2. 把AStyle.exe和test.sh脚本放到工程AStyle目录中,加入Makefile

shell脚本

#!/bin/bashfind ./ -name "*.c" | xargs AStyle -c --style=ansifind ./ -name "*.h" | xargs AStyle -c --style=ansi

DOS的脚本

rem 将当前目录和所有子目录的*.c,*.h文件格式化rem 注意历史原因dos不识别utf8编码的中文rem 编辑dos脚本需要保存为ansi编码,rem 可以用其他编辑器编辑,在复制到记事本中rem add by VkingMan@20170721@echo offfor /R "../" %%s in (,*.h) do AStyle.exe --style=ansi %%sset /p var=删除所有的备份文件*.orig?(Y/N):if %var% equ Y (    echo "rm all the *.orig"    for /R "../" %%s in (*.orig) do del %%s)if %var% equ y (    echo "rm all the *.orig"    for /R "../" %%s in (*.orig) do del %%s)pause

资源下载:http://download.csdn.net/detail/v__king__/9814151