Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Oct 1999 21:20:52 -0700
From:      "N. C. Hong" <nchong@uswest.net>
To:        "'Mohit Aron'" <aron@cs.rice.edu>, <zzhang@cs.binghamton.edu>, <freebsd-net@freebsd.org>
Subject:   RE: Search a symbol in the source tree
Message-ID:  <000f01bf16c4$ab747380$0200000a@gchunghome>
In-Reply-To: <199910122012.PAA23666@cs.rice.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
$ find /usr/src -name "*.c" -print -exec grep "<reg_exp>" {} \; | more

-----Original Message-----
From: owner-freebsd-net@FreeBSD.ORG
[mailto:owner-freebsd-net@FreeBSD.ORG]On Behalf Of Mohit Aron
Sent: Tuesday, October 12, 1999 1:13 PM
To: zzhang@cs.binghamton.edu; freebsd-net@freebsd.org
Subject: Re: Search a symbol in the source tree



> Can anyone suggest me a way of searching symbols in the entire /usr/src
> tree? I normally use grep */*.  But grep does not work recursively, right?
> Something like a small shell script may do this. Thanks a lot.


Rather than using something equivalent to a recursive grep (which is slow),
I prefer to use etags. This gives me the flexibility of searching for
symbols
from within emacs where emacs directly takes me to the section of code that
defines the symbol.

To use, first create a TAGS file with the following command:
   find /usr/src/sys/ -name \*.[ch] -print | etags -
This'll create a TAGS file in the current directory for the kernel source.
Then from within emacs, commands such as:
     M-x find-tag     (also bound to M-.)
are available to search for symbols in the TAGS file. To do a general regexp
search on the code for anything whatsoever, you can use:
     M-x tags-search




- Mohit


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000f01bf16c4$ab747380$0200000a>