9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] locatefn
@ 2004-03-10 12:01 Tiit Lankots
  2004-03-10 15:45 ` Fco.J.Ballesteros
  0 siblings, 1 reply; 2+ messages in thread
From: Tiit Lankots @ 2004-03-10 12:01 UTC (permalink / raw)
  To: Plan 9 Mailing List (E-mail)

While developing, I found myself constantly needing to locate
definitions of functions in a diverse source tree, so I wrote
the following function. If I've reinvented the wheel, please
let me know.

fn locatefn {
	fun=$1
	shift
	if (~ $#* 0) dirs=(.)
	if not dirs=$*
	for (dir in $dirs) {
		files=`{eval echo `{subdirs $dir}^'/*.c'}
		grep -n '^'$fun'\(' /dev/null $files >[2] /dev/null
	}
} 

Tiit


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] locatefn
  2004-03-10 12:01 [9fans] locatefn Tiit Lankots
@ 2004-03-10 15:45 ` Fco.J.Ballesteros
  0 siblings, 0 replies; 2+ messages in thread
From: Fco.J.Ballesteros @ 2004-03-10 15:45 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

You could use this (fg), and
make your code smaller and clean ;-) so that you don't have to
walk fg $f

#!/bin/rc
for (f in $*) { 
	grep -n '^'$f'\(|^struct '$f  *.[cCh] || echo $f : not defined
}

[-- Attachment #2: Type: message/rfc822, Size: 2351 bytes --]

From: "Tiit Lankots" <t.lankots@aprote.ee>
To: "Plan 9 Mailing List (E-mail)" <9fans@cse.psu.edu>
Subject: [9fans] locatefn
Date: Wed, 10 Mar 2004 14:01:08 +0200
Message-ID: <81132473206F3A46A72BD6116E1A06AE479D49@black.aprote.com>

While developing, I found myself constantly needing to locate
definitions of functions in a diverse source tree, so I wrote
the following function. If I've reinvented the wheel, please
let me know.

fn locatefn {
	fun=$1
	shift
	if (~ $#* 0) dirs=(.)
	if not dirs=$*
	for (dir in $dirs) {
		files=`{eval echo `{subdirs $dir}^'/*.c'}
		grep -n '^'$fun'\(' /dev/null $files >[2] /dev/null
	}
} 

Tiit

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-10 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-10 12:01 [9fans] locatefn Tiit Lankots
2004-03-10 15:45 ` Fco.J.Ballesteros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).