[转]cscope在windows下的索引自动编制脚本
转自 http://blog.sina.com.cn/s/blog_5d20ad090100xmq3.html
估计在windows下用vim+cscope+ctags做开发的同好比较少,不然我到现在也没找到windows下自动编制cscope索引的脚本 不过每次敲命令实在麻烦,所以自己写了一个,喜欢的就拿去用吧。
注意一点:windows自带的sort工具和cscope不能兼容,需要下载gnu的sort.exe,这里可以下载gnu工具集http://unxutils.sourceforge.net/ ,下载解压后,将bin目录的路径添加到path环境变量中即可.
源码如下,拷贝到记事本里面,保存为cs.bat直接运行即可。
@echo off
rem naynus@gmail.com
if "%1" == "" (goto l_normal ) else if "%1" == "/c" (goto l_delete ) else (goto l_usage)
:l_delete
if exist cscope.out del cscope.out
if exist cscope.in.out del cscope.in.out
if exist cscope.po.out del cscope.po.out
if exist tags del tags
if exist csfilelist del csfilelist
goto end
:l_normal
if exist cscope.out del cscope.out
if exist cscope.in.out del cscope.in.out
if exist cscope.po.out del cscope.po.out
::set source file type below
dir /s /b *.h *.c *.cpp *.java *.cc > csfilelist
::point to the path contains cscope.exe and sort.exe (gnu sort)
set path="e:\bin"
if exist csfilelist cscope.exe -Rbq -i csfilelist
ctags.exe -R
goto end
:l_usage
@echo off
echo "%0 [/c|/h]"
echo "/c only clean the old out files."
echo "/h display this information."
goto end
:end