home *** CD-ROM | disk | FTP | other *** search
- From: lee@sq.sq.com (Liam R. E. Quin)
- Newsgroups: comp.unix.shell,alt.sources
- Subject: Re: Extract function names
- Message-ID: <1990Sep17.165902.13109@sq.sq.com>
- Date: 17 Sep 90 16:59:02 GMT
-
- chen@digital.sps.mot.com (Jinfu Chen) writes:
- >I'm looking for a tool to extract names of function call in C files. A
- >typical use of it is to build a cross-reference list for function calls. For
- >example, given source files of RN, I would like to find out which file the
- >ngdata_init() call is defined (and optionally) used.
- >
-
- Here is cfind, which prints out the entire function. It assumes a lot
- about indenting styes, though.
- It's easy to hack it to print just the name...
-
- You could also look at "calls", a sort of cross-reference generating
- program, and at "cpr", which emboldens function names.
-
- Lee
-
-
- #! /bin/sh
- if [ "x$1" = "x" -o "x$2" = "x" ]
- then
- echo "Usage: $0 function file [file...]" 1>&2
- exit 1
- fi
-
- pat="$1"
- echo "Looking for $pat" 1>&2
- shift
- for i
- do
- echo "$i:" 1>&2 ; cat "$i" |
- sed -n -e '/^[ ]*[a-zA-Z0-9]*[ ]*[*]*[ ]*'"$pat"'/,/^}/p'
- done
-
- #end
-
- disclaimer: I've not looked at cfind for several years!
-
- Lee
- --
- Liam R. E. Quin, lee@sq.com, SoftQuad Inc., Toronto, +1 (416) 963-8337
- [Granny weatherwax] was opposed to books on strict moral grounds, since she
- had heard that many of them were written by dead people and therefore it
- stod to reason reading them would be as bad as necromancy. [Equal Rites 118]
-