plan9fox/rc/bin/Bfn

19 lines
285 B
Text
Raw Normal View History

2016-08-25 20:36:39 +00:00
#!/bin/rc
2018-05-26 17:17:41 +00:00
rfork e
2016-08-25 20:36:39 +00:00
if(! ~ $#* 1){
echo usage: $0 fn >[2=1]
exit usage
}
2018-05-26 17:17:41 +00:00
if(~ $#srcpath 0) srcpath=.
res=`{grep -n '^'$1'\(' $srcpath/*.c /dev/null | sed -n 's/^([^:]*:[^:]*).*$/\1/gp' }
2016-08-25 20:36:39 +00:00
ifs='
'
for(i in $res)
echo $i
switch($#res){
case 0
echo $1: not found >[2=1]
case 1
B $res
2016-08-25 20:36:39 +00:00
}