私は物事が容易になり、私の.bashrcに次のようしています。 cscope_build()
を実行してデータベースを生成し、cscope
を実行してcscopeツールを起動します。
# Use vim to edit files
export CSCOPE_EDITOR=`which vim`
# Generate cscope database
function cscope_build() {
# Generate a list of all source files starting from the current directory
# The -o means logical or
find . -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.h" -o -name "*.hh" -o -name "*.hpp" > cscope.files
# -q build fast but larger database
# -R search symbols recursively
# -b build the database only, don't fire cscope
# -i file that contains list of file paths to be processed
# This will generate a few cscope.* files
cscope -q -R -b -i cscope.files
# Temporary files, remove them
# rm -f cscope.files cscope.in.out cscope.po.out
echo "The cscope database is generated"
}
# -d don't build database, use kscope_generate explicitly
alias cscope="cscope -d"
'find | grepは少し無駄です。単一の 'find':' findで 'egrep'や' grep -E'を使うことができます。タイプf -print | grep -E '\。(c(pp)?h)$'> cscope.files'と入力します。 –
ええ、そうです。実際には、物事を分かりやすくするために書きました。しかし、とにかくそれは賢明なことではありません。 – leonidus
'cscope -R''または' cscope $(find -iregex '。+ \。[chp] +') ' – Haix64