"Ferret" needed
Paul D. Bame
paul at hp-lsd.UUCP
Wed Oct 16 02:49:00 AEST 1985
Here is a not-too-slow way to generate a database of all the
C functions you have in all your files in a particular subtree of the FS.
Note that it is in two parts:
1) findfn - a script which applies a magic grep to *.[cy] looking
for function definitions (style sensitive to some extent)
2) a find command:
find . -type d -exec findfn {} \; >Index
A sample of output is appended - it's messy but informative and easily
searched with grep. I run this once a week(in background) on my login
subtree. I've found it handy to also do a "ls -CR >Directory"
weekly to prevent me from having to do time-consuming find()'s when
I lose a file.
--Paul Bame
UUCP: {hplabs,ihnp4!hpfcla}!hp-lsd!paul
CSNET: hp-lsd!paul at hp-labs.csnet
ARPA: hp-lsd!paul%hp-labs at csnet-relay.arpa
echo x - findfn
cat >findfn <<'!Funky!Stuff!'
# findfn - grep the .[cy] files in a directory for functions and
# emit those lines containing function definitions. arg #1 is directory
# to search. Matching function definitions is done by matching:
#
# ^identifier[optional-whitespace](
# and eliminating those lines of the form:
# )[optional-whitespace);
#
# Echo is just in case there's only one file in the directory and
# grep then doesn't prepend the file name to matching lines
echo "$1==========================="
grep '^[a-zA-Z_][a-zA-Z_0-9]*[ ]*(' $1/*.[lcy] |
grep -v ')[ ]*;'
!Funky!Stuff!
exit 0
/usr/local/src/cmd===========================
/usr/local/src/cmd/detab.c:main(argc, argv)
/usr/local/src/cmd/detab.c:tabstop( position, tabspaces )
/usr/local/src/cmd/entab.c:entab(tabstop)
/usr/local/src/cmd/entab.c:main(argc, argv)
/usr/local/src/cmd/keys.c:main()
/usr/local/src/cmd/keys.c:parsekey(keynum,buffer,kptr)
/usr/local/src/cmd/keys.c:programkey(kptr)
/usr/local/src/cmd/phist.c:main(argc,argv)
/usr/local/src/cmd/toascii.c:main()
/usr/local/src/cmd/toascii.c:to_ascii(c,c1)
/usr/local/src/cmd/toascii.c:to_binary(c)
/usr/local/src/cmd/tohex.c:to_hex(c)
/usr/local/src/cmd/tohex.c:main(argc,argv)
/usr/local/src/cmd/patch1.3===========================
main(argc,argv)
reinitialize_almost_everything()
get_some_switches()
More information about the Comp.sources.unix
mailing list