-
-
Notifications
You must be signed in to change notification settings - Fork 234
/
cscope.run
executable file
·51 lines (45 loc) · 929 Bytes
/
cscope.run
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
#!/bin/sh
#
# Run cscope for PCP source (src and qa)
#
tmp=/var/tmp/cscope.run.$$
trap "rm -f $tmp.*; exit 0" 0 1 2 3 15
rebuild=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
export INCDIR=
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"
exit 1
fi
if $rebuild || [ ! -f cscope.files ]
then
rm -f cscope.out cscope.files
git ls-files >$tmp.tmp
find src 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
cscope -b -i cscope.files
fi
cscope -i cscope.files