Skip to content

Instantly share code, notes, and snippets.

@huzhifeng
Created August 2, 2014 18:35
Show Gist options
  • Save huzhifeng/16dce14e9f4d595484db to your computer and use it in GitHub Desktop.
Save huzhifeng/16dce14e9f4d595484db to your computer and use it in GitHub Desktop.
Automatic cscope
#!/bin/sh
cs_install() {
echo "installing ..."
if [ ! -e cscope.files ]
then
find ./ -name "*.[hc]" > cscope.files
else
echo "cscope.files exist"
fi
if [ ! -e cscope.out ]
then
cscope -bkq -i cscope.files
else
echo "cscope.out exist"
fi
if [ ! -e tags ]
then
ctags -R
else
echo "tags exist"
fi
echo "installing finished"
}
cs_clean() {
echo "cleaning ..."
rm -rf cscope.* tags
echo "cleaning finished"
}
if [ $# == 0 ]
then
action="install"
else
action=$1
fi
case "$action" in
install)
cs_install
;;
clean)
cs_clean
;;
update)
cs_clean
cs_install
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment