Thread View: comp.unix.shell
1 messages
1 total messages
Started by Liam R. E. Quin
Mon, 17 Sep 1990 16:59
Re: Extract function names
Author: Liam R. E. Quin
Date: Mon, 17 Sep 1990 16:59
Date: Mon, 17 Sep 1990 16:59
43 lines
1494 bytes
1494 bytes
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]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads