lee@sq.sq.com (Liam R. E. Quin) (09/17/90)
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]