~kris/9p

glenda

ref: c0f1d92cc6ae334cbeaeaaa891282b014723d163 glenda/x/mux/man/sig -rwxr-xr-x 601 bytes
c0f1d92c — Kris Yotam docs: mark as fork of henesy/glenda 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env rc
# Usage: sig key ...
#	prints out function signatures by grepping the manual

MIRROR = /usr/share/mirror/plan9front
*=`{echo $*|tr A-Z a-z|tr -dc 'a-z0-9_ \012'}	# fold case, delete funny chars
if(~ $#* 0){
	echo Usage: sig function ...
	exit 1
}

for (i) {
	files=`{9 grep -il '[ 	]\*?'$i'\(' $MIRROR/sys/man/2/*}
	for(j in $files) {
		{echo .nr LL 20i; 9 sed -n '/^.SH SYNOPSIS/,/^.SH.*DESCR/p'  $j } |
			9 nroff -man |
			sed '
				:a
				/,$/ {
					N
					s/\n//
				}
				ta
				s/[ 	]+/ /g' |
			9 grep -i -e '[ 	*]'$i'\(' | sed 's/^[ +]/	/' | sed 's/	    //g'
	}
}

exit 0