1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!/bin/sh
#
# Run cscope for PCP source (src and qa)
#
tmp=${TMPDIR:-/tmp}/cscope.run.$$
trap "rm -f $tmp.*; exit 0" 0 1 2 3 15
rebuild=false
skip_libpcp3=false
if [ $# -eq 1 ]
then
case "$1"
in
-b) # rebuild files list and index
rebuild=true
shift
;;
-x) # rebuild and exclude /usr/include
rebuild=true
INCDIR=; export INCDIR
shift
;;
-3) # rebuild and exclude src/libpcp3
rebuild=true
skip_libpcp3=true
shift
;;
esac
fi
if [ $# -ne 0 ]
then
echo >&2 "Usage: cscope.run [options]"
echo >&2 "Options:"
echo >&2 "-b rebuild files list and index"
echo >&2 "-x exclude /usr/include, implies -b"
echo >&2 "-3 exclude src/libpcp3, implies -b"
exit 1
fi
if $rebuild || [ ! -f cscope.files ]
then
rm -f cscope.out cscope.files
git ls-files >$tmp.tmp
find src vendor qa -type f -a \( -name "*.[chly]" -o -name "*.h.in" -o -name "*.y.in" -o -name "*.cpp" \) \
| while read file
do
if grep "^$file\$" $tmp.tmp >/dev/null
then
echo "$file" >>cscope.files
fi
done
if $skip_libpcp3
then
sed -i -e '/^src\/libpcp3\//d' cscope.files
fi
cscope -b -i cscope.files
fi
cscope -i cscope.files
|