From owner-freebsd-questions Wed Mar 22 07:53:28 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id HAA07582 for questions-outgoing; Wed, 22 Mar 1995 07:53:28 -0800 Received: from netcom13.netcom.com (root@netcom13.netcom.com [192.100.81.125]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id HAA07576 for ; Wed, 22 Mar 1995 07:53:26 -0800 Received: by netcom13.netcom.com (8.6.10/Netcom) id HAA01124; Wed, 22 Mar 1995 07:18:58 -0800 Date: Wed, 22 Mar 1995 07:18:58 -0800 From: pascal@netcom.com (Richard A Childers) Message-Id: <199503221518.HAA01124@netcom13.netcom.com> To: PVinci@ix.netcom.com, questions@FreeBSD.org Subject: Re: How to search through sources?? Sender: questions-owner@FreeBSD.org Precedence: bulk "How can I search through the sources to find a Procedure? For example, if I wanted to look at the panic() function. Is there a tool that will scan the sources? (P.S. I'm not looking for panic())" Well, before you go looking through the sources, try the man pages. % man -k panic # finds all man pages with keyword 'panic' Try a more manual approach to searching the man pages : % ls /usr/share/man/*/*panic* ( If you don't have the man pages installed correct this right away. ) If you still need to search the sources : % find /usr/src -type f -name '*panic*' -print This will find all files with the pattern '*panic*' in the filename. However, it is quite common for several routines ( function, procedures, what have you ) to be collected into a single 'header' file, as a library, so another technique ( taking this into account ) might be : % find /usr/src -type f -exec grep -n "panic" {} \; -print This searches every file under /usr/src for the pattern "panic", printing those lines it encounters the pattern in, followed by the name of the file the line(s) were encountered in. ( The '-n' flag gives the line number. ) Redirect this into a file and use a text editor to browse it for the place where the routine is originally defined. Caveat : this is all based upon the assumption that /usr/src is readable to the world or that you have placed yourself in the appropriate groups to access the /usr/src tree. If you see 'Permission denied', you probably need to try this as root ( although fixing the problem and returning to running the search, as yourself, is really the best solution ). -- richard Pontius Pilate was politically correct. So was Benedict Arnold. So was Vidkun Quisling ... and so was Adolph Hitler. |-: richard childers san francisco, california pascal@netcom.com