File: vifn

package info (click to toggle)
pmccabe 2.8-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 876 kB
  • sloc: ansic: 3,084; cpp: 1,080; sh: 401; makefile: 42
file content (35 lines) | stat: -rwxr-xr-x 516 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
#!/bin/sh

if [ $# = 0 ]
then
    echo "Usage: `basename $0` [filename/]functionname [...]" >&2
    exit 2
fi

exec 3<&0

while [ $# != 0 ]
do
    fname=`dirname "$1"`
    fn=`basename "$1"`

    if [ $fname = "." ]
    then
	if [ ! -f pmccabe.out ]
	then
	    pmccabe *.[CcHh] >pmccabe.out
	fi

	grep ": $fn$" pmccabe.out

    else
	pmccabe $fname | grep ": $fn"
    fi |
	sed 's/[()]/ /g' |
	while read c1 c2 statements l1 nl filename linenumber fnname
	do
	    vi +$linenumber $filename <&3
	done

    shift
done