Re: Search a symbol in the source tree
On Monday, 18 October 1999 at 3:17:31 +0900, ?$B8EC+?(B ?$BE/O:?(B wrote: From: Jacques Vidrine [EMAIL PROTECTED] Subject: Re: Search a symbol in the source tree Date: Sun, 17 Oct 1999 11:37:11 -0500 n On 18 October 1999 at 0:39, Tetsuro Teddy FURUYA (=?iso-2022-jp?B?GyRCOEVDKxsoQiAbJEJFL086GyhC?=) [EMAIL PROTECTED] wrote: n It seems queer to me that there has been none who has refered to n find - exec n pairs. n n You may type into shell like; n $find . -name "*.c" -print -exec "egrep" "-i" "idt" {} \; | less n Here , "idt" is a search string. n n That's because no one wants a separate invocation of egrep for n every file! ^^ Probably, except me ! And why do you want it? Do you have too much time on your hands? Greg -- Finger [EMAIL PROTECTED] for PGP public key See complete headers for address and phone numbers To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
RE: Search a symbol in the source tree
Thank you for your mail. -Original Message- ·ol : Darryl Okahata [EMAIL PROTECTED] ¼ : Re: Search a symbol in the source tree But, what various and interesting methods to search symbols there are ! Do people actually read what's posted here? A few days ago, I posted a detailed comparison of various packages. Go read the archives: Your mail is rather long and the conclusion is hard to grip for me. Is your point is that for grep with -R option ...with grep, you need to limit your searches. Also, "grep -R" doesn't work very well and, for global ...I've got mixed feelings about global. ... ...for best results, you have to remember to use different options when searching ... ??? Am I right ? http://www.freebsd.org/cgi/getmsg.cgi?fetch=331467+341670+/usr/local/www/db /text/1999/freebsd-hackers/19991017.freebsd-hackers Side note: Shigio Yamaguchi [EMAIL PROTECTED] has found some issues and bugs regarding GLOBAL, and so GLOBAL is not as bad as the article makes it out to be. -- Darryl Okahata [EMAIL PROTECTED] Teddy Furuya [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
Probably, my mail did not reach freebsd-hackers mailing list because of absense of inreply-to headers. So, I will resend. Message-ID: 000801bf1a44$bb587ca0$[EMAIL PROTECTED] From: "Teddy" tfuruya To: "Darryl Okahata" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: Search a symbol in the source tree Date: Wed, 20 Oct 1999 00:13:10 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Thank you for your mail. -Original Message- Sender : Darryl Okahata [EMAIL PROTECTED] Subject : Re: Search a symbol in the source tree But, what various and interesting methods to search symbols there are ! Do people actually read what's posted here? A few days ago, I posted a detailed comparison of various packages. Go read the archives: Your mail is rather long and the conclusion is hard to grip for me. Is your point is that for grep with -R option ...with grep, you need to limit your searches. Also, "grep -R" doesn't work very well and, for global ...I've got mixed feelings about global. ... ...for best results, you have to remember to use different options when searching ... ??? Am I right ? http://www.freebsd.org/cgi/getmsg.cgi?fetch=331467+341670+/usr/local/www/db /text/1999/freebsd-hackers/19991017.freebsd-hackers Side note: Shigio Yamaguchi [EMAIL PROTECTED] has found some issues and bugs regarding GLOBAL, and so GLOBAL is not as bad as the article makes it out to be. -- Darryl Okahata [EMAIL PROTECTED] Teddy Furuya [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
Probably, my mail did not reach freebsd-hackers mailing list because of absense of inreply-to headers. So, I will resend. Message-ID: 001301bf192c$18daa160$[EMAIL PROTECTED] From: "Teddy" tfuruya To: "Greg Lehey" [EMAIL PROTECTED], [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: Search a symbol in the source tree Date: Mon, 18 Oct 1999 14:45:08 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Thank you for replying to me. -Original Message- Greg Lehey [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED] CC : [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED] Re: Search a symbol in the source tree n On 18 October 1999 at 0:39, Tetsuro Teddy FURUYA (=?iso-2022-jp?B?GyRCOEVDKxsoQiAbJEJFL086GyhC?=) [EMAIL PROTECTED] wrote: n It seems queer to me that there has been none who has refered to n find - exec n pairs. n $find . -name "*.c" -print -exec "egrep" "-i" "idt" {} \; | less n Here , "idt" is a search string. n That's because no one wants a separate invocation of egrep for n every file! ^^ Probably, except me ! And why do you want it? Do you have too much time on your hands? I think that if we do not know old-fashed methods , we can not appreciate the goodcharacteristics of the various methods such as xargs, glimpse, grep with -R option, and global. Now, I have started to use full.exe from cygnus-b20, and its grep does not have -R option. Fortunately it has xargs, so I can utilize both of xargs and find at the same time. But, at this circumstance, we have to pay attention to the fact that xargs can not work well all the time. When seeing manpage xargs(1), they say, Undefined behavior may occur if utility reads from the standard input. (I don't know there exists such a case really.) And, there might exist find -exec option in the older scripts. So, -exec option of the command find is still usefull and very important. If the user don't like the listing of the umatched file name at such circumstances, he/she might execute find like, find /usr/src/sys -name "*" -and -exec grep "-ia" idt {} \; -print | less or, find /usr/src/sys -name "*" -exec grep "-ia" idt {} \; -print | less As for me, when I began to use find at the first time, the find was rather difficult to use. But now it is amusing. Teddy Furuya [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
Probably, my mail did not reach freebsd-hackers mailing list because of absense of inreply-to headers. So, I will resend. Return-Path: POPmail Delivery-Agent: @(#)$Id: local.c,v 1.54 1998/10/30 06:30:53 akira1 Exp $ on canberra Received: by j.asahi-net.or.jp (ATSON-1) ; 20 Oct 1999 01:14:43 +0900 Return-Path: [EMAIL PROTECTED] Received: from ppp142140.asahi-net.or.jp (ppp142140.asahi-net.or.jp [202.213.142.140]) by tiga.asahi-net.or.jp (8.8.8/3.7W) with ESMTP id BAA22992 for [EMAIL PROTECTED]; Wed, 20 Oct 1999 01:11:18 +0900 (JST) Received: from dilemma (tf051005.tf.or.jp [192.168.51.5]) by galois.tf.or.jp (8.9.3/3.7W-Teddy-99050304) with SMTP id AAA28922; Wed, 20 Oct 1999 00:18:03 +0900 (JST) Message-ID: 000201bf1a45$7952d340$[EMAIL PROTECTED] From: "Teddy" [EMAIL PROTECTED] To: "Brian Beattie" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: Search a symbol in the source tree Date: Wed, 20 Oct 1999 00:13:58 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by tiga.asahi-net.or.jp id BAA22992 Thank you for your mail ! At last, the final resolution has arrived ! Your answer is very very elegant and splendid ! -Original Message- From : Brian Beattie [EMAIL PROTECTED] Sender : Tetsuro Teddy FURUYA [EMAIL PROTECTED] CC : [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED] =93=FA=8E=9E : 1999=94N10=8C=8E19=93=FA 1:51 Subject : Re: Search a symbol in the source tree On Mon, 18 Oct 1999, Tetsuro Teddy FURUYA wrote: From: Jacques Vidrine [EMAIL PROTECTED] Subject: Re: Search a symbol in the source tree Date: Sun, 17 Oct 1999 11:37:11 -0500 n On 18 October 1999 at 0:39, Tetsuro Teddy FURUYA (=3D?iso-2022-jp?B?GyRCOEVDKxsoQiAbJEJFL086GyhC?=3D) ht5t-fry@asahi-net.= or.jp wrote: n It seems queer to me that there has been none who has refered to n find - exec n pairs. n n You may type into shell like; n $find . -name "*.c" -print -exec "egrep" "-i" "idt" {} \; | less n Here , "idt" is a search string. n n That's because no one wants a separate invocation of egrep for n every file! ^^ Probably, except me ! But, what various and interesting methods to search symbols there are = ! If we do not restrict the usage of search method, there might be yet another methods. I frequently use find - grep when looking at a novel source tree. The o= ne problem with the solution given is that if you are looking for a few instances in hundreds of files, the hits can scroll off the screen and g= et lost in the noise. My prefered approach is: find . -name "*.[c]" -exec grep string {} /dev/null \; Your idea to make grep read the dummy file /dev/null as multiple files re= ad is elegant and splendid ! Finally, find with -exec option outputs the same listing as grep with -R option and find - xargs pipeline. I have tried the bench mark test. #Script started on Tue Oct 19 23:00:15 1999 #sh-2.02$ time find /usr/src/sys -name "*" -and -exec grep "-ia" idt {} \; -print /dev/null #real 1m14.920s #user 0m16.454s #sys 0m20.259s # #sh-2.02$ time find /usr/src/sys -name "*" -exec grep "-ia" idt {} /dev/n= ull \; /dev/null #real 1m16.742s #user 0m16.289s #sys 0m20.449s # #sh-2.02$ time find /usr/src/sys -name "*" | xargs grep "-ia" idt /dev/null #real 0m44.862s #user 0m0.989s #sys 0m1.669s #sh-2.02$ exit #exit #Script done on Tue Oct 19 23:16:04 1999 @@From this result, xargs is faster as it is predicted. And the comsumed time to read /dev/null file is unexpectedly short. (the /dev/null forces grep to print the filename where a match is found, and I am an old fogey, learned grep before [ef]grep too lazy to learn better, should probably use fgrep) What I'd really like to see is a free implementation of cscope. Brian Beattie| The only problem with [EMAIL PROTECTED] | winning the rat race ... www.aracnet.com/~beattie | in the end you're still a rat Teddy Furuya [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
RE: Search a symbol in the source tree
Thank you for replying to me. -Original Message- Greg Lehey [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED] CC : [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED] Re: Search a symbol in the source tree n On 18 October 1999 at 0:39, Tetsuro Teddy FURUYA (=?iso-2022-jp?B?GyRCOEVDKxsoQiAbJEJFL086GyhC?=) [EMAIL PROTECTED] wrote: n It seems queer to me that there has been none who has refered to n find - exec n pairs. n $find . -name "*.c" -print -exec "egrep" "-i" "idt" {} \; | less n Here , "idt" is a search string. n That's because no one wants a separate invocation of egrep for n every file! ^^ Probably, except me ! And why do you want it? Do you have too much time on your hands? I think that if we do not know old-fashed methods , we can not appreciate the goodcharacteristics of the various methods such as xargs, glimpse, grep with -R option, and global. Now, I have started to use full.exe from cygnus-b20, and its grep does not have -R option. Fortunately it has xargs, so I can utilize both of xargs and find at the same time. But, at this circumstance, we have to pay attention to the fact that xargs can not work well all the time. When seeing manpage xargs(1), they say, Undefined behavior may occur if utility reads from the standard input. (I don't know there exists such a case really.) And, there might exist find -exec option in the older scripts. So, -exec option of the command find is still usefull and very important. If the user don't like the listing of the umatched file name at such circumstances, he/she might execute find like, find /usr/src/sys -name "*" -and -exec grep "-ia" idt {} \; -print | less or, find /usr/src/sys -name "*" -exec grep "-ia" idt {} \; -print | less As for me, when I began to use find at the first time, the find was rather difficult to use. But now it is amusing. Teddy Furuya [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
Of course, this is probably more efficiently run as 'find . -name "*.c" -print | xargs egrep -i idt | less'. If you have interesting filenames (containing spaces, for instance), you'll probably want to use -print0 and whichever -0 to xargs. zsh users can often use 'egrep -i idt **/*.c', but that doesn't work so well if you have too many matches for the command-line to handle. [Yes, anything like this is "slow" for some definition of the word "slow". On a particular source tree I frequently work with, the *.c files contain 256klines of code, and running a find/xargs egrep on them takes 11s on the first run - and 1s on the second. Quite sufficient if you tend to do most of your work in a single module and only periodically need to foray onto unfamiliar terrain...] Later, scott - Original Message - From: Tetsuro Teddy FURUYA ($B8EC+(B $BE/O:(B) [EMAIL PROTECTED]) To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, October 17, 1999 11:17 AM Subject: Re: Search a symbol in the source tree From: Jacques Vidrine [EMAIL PROTECTED] Subject: Re: Search a symbol in the source tree Date: Sun, 17 Oct 1999 11:37:11 -0500 n On 18 October 1999 at 0:39, Tetsuro Teddy FURUYA (=?iso-2022-jp?B?GyRCOEVDKxsoQiAbJEJFL086GyhC?=) [EMAIL PROTECTED] wrote: n It seems queer to me that there has been none who has refered to n find - exec n pairs. n n You may type into shell like; n $find . -name "*.c" -print -exec "egrep" "-i" "idt" {} \; | less n Here , "idt" is a search string. n n That's because no one wants a separate invocation of egrep for n every file! ^^ Probably, except me ! But, what various and interesting methods to search symbols there are ! If we do not restrict the usage of search method, there might be yet another methods. Teddy Furuya [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
A couple of useful packages can make this much quicker. mkid from ports/devel/id-utils builds a database of symbols given a source tree. Then you can use gid to grep for a symbol, lid to get a list of files that havea symbol etc. mkid knows about c, c++ and may be some other languages. If you want to search for arbitrary words, you can use glimpseindex from port/textproc/glimpse to build the database and agrep to search for words. agrep is like grep except more powerful! It can also do `approximate' searches among other things. Here is a handy agrep use to whet your appetite. zsh rfc () { agrep -t -i -d'$$' $* /usr/local/doc/rfc/rfc-index.txt } Now, for example, I can get a list of RFCs that W. Stevens wrote on IPv6: zsh rfc 'steve;ipv6' 2133 Basic Socket Interface Extensions for IPv6. R. Gilligan, S. Thomson, J. Bound, W. Stevens. April 1997. (Format: TXT=69737 bytes) (Obsoleted by RFC2553) (Status: INFORMATIONAL) 2292 Advanced Sockets API for IPv6. W. Stevens, M. Thomas. February 1998. (Format: TXT=152077 bytes) (Status: INFORMATIONAL) 2553 Basic Socket Interface Extensions for IPv6. R. Gilligan, S. Thomson, J. Bound, W. Stevens. March 1999. (Format: TXT=89215 bytes) (Obsoletes RFC2133) (Status: INFORMATIONAL) But I digress! The point is there are better tools than what is available in the "beginner's toolkit" of the basic Unix commands. Then there is `global' which can be used to generate tags file as well as create an htmlized version of your source tree. Someone should write a `Unix powertools' book. Not me. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
On Mon, 18 Oct 1999, Tetsuro Teddy FURUYA wrote: From: Jacques Vidrine [EMAIL PROTECTED] Subject: Re: Search a symbol in the source tree Date: Sun, 17 Oct 1999 11:37:11 -0500 n On 18 October 1999 at 0:39, Tetsuro Teddy FURUYA (=?iso-2022-jp?B?GyRCOEVDKxsoQiAbJEJFL086GyhC?=) [EMAIL PROTECTED] wrote: n It seems queer to me that there has been none who has refered to n find - exec n pairs. n n You may type into shell like; n $find . -name "*.c" -print -exec "egrep" "-i" "idt" {} \; | less n Here , "idt" is a search string. n n That's because no one wants a separate invocation of egrep for n every file! ^^ Probably, except me ! But, what various and interesting methods to search symbols there are ! If we do not restrict the usage of search method, there might be yet another methods. I frequently use find - grep when looking at a novel source tree. The one problem with the solution given is that if you are looking for a few instances in hundreds of files, the hits can scroll off the screen and get lost in the noise. My prefered approach is: find . -name "*.[c]" -exec grep string {} /dev/null \; (the /dev/null forces grep to print the filename where a match is found, and I am an old fogey, learned grep before [ef]grep too lazy to learn better, should probably use fgrep) What I'd really like to see is a free implementation of cscope. Brian Beattie| The only problem with [EMAIL PROTECTED] | winning the rat race ... www.aracnet.com/~beattie | in the end you're still a rat To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
But, what various and interesting methods to search symbols there are ! Do people actually read what's posted here? A few days ago, I posted a detailed comparison of various packages. Go read the archives: http://www.freebsd.org/cgi/getmsg.cgi?fetch=331467+341670+/usr/local/www/db/text/1999/freebsd-hackers/19991017.freebsd-hackers Side note: Shigio Yamaguchi [EMAIL PROTECTED] has found some issues and bugs regarding GLOBAL, and so GLOBAL is not as bad as the article makes it out to be. -- Darryl Okahata [EMAIL PROTECTED] DISCLAIMER: this message is the author's personal opinion and does not constitute the support, opinion, or policy of Hewlett-Packard, or of the little green men that have been following him all day. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
From: Zhihui Zhang [EMAIL PROTECTED] Subject: Search a symbol in the source tree Date: Tue, 12 Oct 1999 10:32:00 -0400 (EDT) Message-ID: [EMAIL PROTECTED] zzhang zzhang Can anyone suggest me a way of searching symbols in the entire /usr/src zzhang tree? I normally use grep */*. But grep does not work recursively, right? zzhang Something like a small shell script may do this. Thanks a lot. It seems queer to me that there has been none who has refered to find - exec pairs. You may type into shell like; $find . -name "*.c" -print -exec "egrep" "-i" "idt" {} \; | less Here , "idt" is a search string. Teddy Furuya [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
On 18 October 1999 at 0:39, Tetsuro Teddy FURUYA (=?iso-2022-jp?B?GyRCOEVDKxsoQiAbJEJFL086GyhC?=) [EMAIL PROTECTED] wrote: It seems queer to me that there has been none who has refered to find - exec pairs. You may type into shell like; $find . -name "*.c" -print -exec "egrep" "-i" "idt" {} \; | less Here , "idt" is a search string. That's because no one wants a separate invocation of egrep for every file! -- Jacques Vidrine / [EMAIL PROTECTED] / [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
Darryl Okahata [EMAIL PROTECTED] wrote: Looking for where "utmp.h" is used: global -x -s utmp.h This takes more than 2212 seconds (over 36 minutes!), and outputs It seems that something wrong (bug?) occurred. Would you please tell me the version of FreeBSD and GLOBAL? This runs quickly, but displays nothing. Next, try: global -x -s KBD_DATA_PORT This runs quickly, and shows where this is used in .c source files. However, where's the definition? It's not shown. It's a bug that appeared between GLOBAL-3.3 and 3.44 and fixed in 3.5. -- Shigio Yamaguchi - Tama Communications Corporation Mail: [EMAIL PROTECTED], WWW: http://www.tamacom.com To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
Peter Jeremy [EMAIL PROTECTED] wrote: I use id-utils (/usr/ports/devel/id-utils). It builds a single database file and has a variety of tools (including e-lisp) to search the database. Since global(1) was mentioned in this threaad, I decided to have a look at it. It seems much slower and my sample (samba-2.0.5a) database was nearly 20 times larger. Well, as a longtime-user of mkid, mkid2, and mkid3 (the predecessors to id-utils), here are some comments on the various packages: [ Note: in the following, I'm not quite comparing apples and apples. However, I'm too lazy to do a strict comparison, but this should still give people a vague idea of each package's performance. Take the following as you will, with a grain of salt. ] * As a baseline, let's look at plain grep. First, generate a list of files to search (this assumes that we don't want to look through all files, including Makefiles, man pages, etc.): cd /usr/src find * -type f | time grep '\.[chsSly][cxp]*$' /tmp/foo Now, on my system (-current from Aug. 21, a PII 300MHz w/128MB a F/W SCSI disk), this takes around 50 seconds (real time): xargs grep ptrace /tmp/foo Not too bad, but not great, either. Let's try looking for utmp.h: xargs grep 'utmp\.h' /tmp/foo This takes around a minute. Now, let's look at "grep -R": cd /usr/src grep -R ptrace .# 2 minutes 42 seconds grep -R 'utmp\.h' . # 2 minutes 40 seconds In other words, with grep, you need to limit your searches. Also, "grep -R" doesn't work very well if you also happen to have glimpse, global, or mkid/id-utils indices under /usr/src. * Global is OK (does not appear to support C++, though), but generates HUGE databases (by default). For /usr/src, the databases are around as large as the total size of the indexed source files (the gtags "-c" option was not used). Indexing is slow, but searching seems to be quite fast. In particular, "global -x name" is nice, because it just return where "name" is defined, as opposed to a plain grep which can also return matches on "fooname" and "namebar", as well as where "name" is used. However, global appears to be optimized for locating where a function is defined. It appears to be difficult to locate, for example, where a preprocessor macro is defined; except for "global -g" (which is often too slow to be usable), I haven't found a way of getting global to search through .h header files. On my system, indexing /usr/src took around an hour, and the indices took up around 240MB+ (this was with "gtags" and not "gtags -c"). This is 20+ times larger than a glimpse or mkid/id-utils database. It's interesting to note that "global -x -g ptrace" takes around twice as long to execute (over two minutes), compared to plain grep. However, "global -x -s ptrace" is very fast (under 1 second). Searching for ptrace generates two (2) lines of output, in well under one second: global -x ptrace as do these: global -x -s ptrace global -x -s uap Looking for where "utmp.h" is used: global -x -s utmp.h This takes more than 2212 seconds (over 36 minutes!), and outputs nothing. Well, let's try this instead: global -x -g utmp.h This works, taking a bit over a minute and a half. However, plain grep is faster (note that, as global searches through source files only, you have to compare it to the source-file-only grep, and not "grep -R"). However, looking for the definition of a preprocessor macro is a pain. Try looking for KBD_DATA_PORT: global -x KBD_DATA_PORT This runs quickly, but displays nothing. Next, try: global -x -s KBD_DATA_PORT This runs quickly, and shows where this is used in .c source files. However, where's the definition? It's not shown. This works: global -x -g KBD_DATA_PORT However, this takes around two minutes to run, which is much slower than a plain grep. * Glimpse is a general-purpose text indexer which can be used to index source files. It's basically an intelligent grep, but it works quite well. Unlike mkid, you can search through comments and non-source files (like Makefiles, man pages, README's, etc.). On my system, indexing /usr/src took around 6 minutes (using the "-M 20" option), and the indices took up around 10MB. On my system, searching for ptrace took 35 seconds, with 505 lines of output (ChangeLogs, man pages, etc. account for the extra lines): glimpse -w ptrace Searching for uap takes around 21 seconds: glimpse -w uap Looking for utmp.h: glimpse -y -w utmp.h This takes a bit over 45 seconds. However, glimpse searched through (and displayed hits in) non-source files, like configure, configure.in, Makefiles, etc.. It is possible to have glimpse exclude certain files and
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. -Zhihui find . -name '*' | xargs grep expression ...or something :) regards, v0rbiz To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
I find it ironic that nobody has suggested global yet; That sure would make a nice port, especially since we could easily recommend gozilla as a nice way to browse and search the source tree. Cheers, Jerry Hicks [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
In article [EMAIL PROTECTED], W Gerald Hicks [EMAIL PROTECTED] wrote: I find it ironic that nobody has suggested global yet; That sure would make a nice port, especially since we could easily recommend gozilla as a nice way to browse and search the source tree. Er, global is part of the base system. :-) John -- John Polstra [EMAIL PROTECTED] John D. Polstra Co., Inc.Seattle, Washington USA "No matter how cynical I get, I just can't keep up."-- Nora Ephron To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
On Wed, 13 Oct 1999, John Polstra wrote: That sure would make a nice port, especially since we could easily recommend gozilla as a nice way to browse and search the source tree. Er, global is part of the base system. :-) And for those who like to point and laugh: c [1998/08/11] ports/7580 portsnew port: devel/global -- - bill fumerola - [EMAIL PROTECTED] - BF1560 - computer horizons corp - - ph:(800) 252-2421 - [EMAIL PROTECTED] - [EMAIL PROTECTED] - To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
Er, global is part of the base system. :-) Hehe, I knew that. My point was that the entire package isn't built and the author's going GPL anyway and since nobody recommended it ... That sure would make a nice port ;-) For the original poster gtags/htags is an excellent tool for your purposes. In its full installation it can generate html versions of your code and is chock full of other features too. Give it a test drive :-) Cheers, Jerry Hicks [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
On Wed, 13 Oct 1999, W Gerald Hicks wrote: Er, global is part of the base system. :-) Hehe, I knew that. My point was that the entire package isn't built and the author's going GPL anyway and since nobody recommended it ... That sure would make a nice port ;-) That's simply not true, and we know (since it was on the mailing list) that you know better. The author's committed to keeping the BSD version current, and in the present license. You said you were for pruning down the size of FreeBSD, which is a defensible position, but misrepresenting the author is really unfair, and you can't justify what you're doing here because of it. You were called on this when you did it then, too. For the original poster gtags/htags is an excellent tool for your purposes. In its full installation it can generate html versions of your code and is chock full of other features too. Give it a test drive :-) Cheers, Jerry Hicks [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message Chuck Robey| Interests include C programming, Electronics, 213 Lakeside Dr. Apt. T-1 | communications, and signal processing. Greenbelt, MD 20770| I run picnic.mat.net: FreeBSD-current(i386) and (301) 220-2114 | jaunt.mat.net : FreeBSD-current(Alpha) To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
In the last episode (Oct 12), Zhihui Zhang said: 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. If you use zsh, it has a "recursive glob": grep draw_mouse **/*.c You could also use find | xargs: find . -name "*.c" | xargs grep draw_mouse Or you could use gtags/global: gtags global -gx "draw_mouse" If you're really looking for the source file that defines a symbol, global is the way to go. -- Dan Nelson [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
Out of da blue Zhihui Zhang aka ([EMAIL PROTECTED]) said: 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. Have you taken a look at global, gtags, or htags. They are part of the base system. Also 'http://lxr.linux.no/freebsd/source' is rather helpful ... -Zhihui #:^) -- So ya want ta here da roots? Dem that feels it knows it ... bush doctor [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
Zhihui Zhang wrote: 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. find /usr/src -name \*.\[ch] -print | xargs grep pattern or similar. -- Daniel C. Sobral(8-DCS) [EMAIL PROTECTED] [EMAIL PROTECTED] "I always feel generous when I'm in the inner circle of a conspiracy to subvert the world order and, with a small group of allies, just defeated an alien invasion. Maybe I should value myself a little more?" To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
On Tue, 12 Oct 1999, bush doctor wrote: Have you taken a look at global, gtags, or htags. They are part of the base system. Also 'http://lxr.linux.no/freebsd/source' is rather helpful ... or the glimpse port. or grep -R, which is recursive grep. Kris XOR for AES -- join the campaign! To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: Search a symbol in the source tree
On Tuesday, 12 October 1999 at 10:32:00 -0400, Zhihui Zhang wrote: 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. I use etags for this, in conjunction with Emacs. Like that, I can position the cursor on a word, press Alt-., and it will find the definition for me. It will also search for all occurrences with Alt-S. Greg -- See complete headers for address, home page and phone numbers finger [EMAIL PROTECTED] for PGP public key To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message