File: cscope.run

package info (click to toggle)
pcp 6.3.8-1
  • links: PTS
  • area: main
  • in suites: sid, trixie
  • size: 235,180 kB
  • sloc: ansic: 1,253,622; sh: 173,998; xml: 160,490; cpp: 83,331; python: 20,482; perl: 18,302; yacc: 6,886; makefile: 2,955; lex: 2,862; fortran: 60; java: 52
file content (51 lines) | stat: -rwxr-xr-x 929 bytes parent folder | download | duplicates (2)
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