Created
February 12, 2014 15:11
-
-
Save myme/8957226 to your computer and use it in GitHub Desktop.
cscope hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PIDFILE=.git/cscope.pid | |
log() { | |
: # echo "[$$]" $(date +'%F %T'): "$@" >>.git/cscope.log | |
} | |
if [ -e $PIDFILE ]; then | |
PID=$(cat $PIDFILE) | |
PGRP=$(ps x -o "%p %r" | grep $PID | awk '{print $2}') | |
log "Killing process group $PGRP" | |
kill -TERM -$PGRP | |
fi | |
echo $$ >.git/cscope.pid | |
log "Finding files" | |
find . | egrep '.*\.(c(pp)?|h(pp)?)$' > .git/cscope.files | |
log "Running cscope" | |
cscope -i .git/cscope.files -bq | |
log "Clean up" | |
rm $PIDFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment