]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/sig
fstype: make copy of first sector in /env to avoid unaligned reads on the disk (for...
[plan9front.git] / rc / bin / sig
1 #!/bin/rc
2 # Usage: sig key ...
3 #       prints out function signatures by grepping the manual
4
5
6 *=`{echo $*|tr A-Z a-z|tr -dc 'a-z0-9_ \012'}   # fold case, delete funny chars
7 if(~ $#* 0){
8         echo Usage: sig function ... >/fd/2
9         exit 1
10 }
11
12 for (i) {
13         files=`{grep -il '[     ]\*?'$i'\(' /sys/man/2/*}
14         for(j in $files) {
15                 {echo .nr LL 20i; sed -n '/^.SH SYNOPSIS/,/^.SH.*DESCR/p'  $j } |
16                         nroff -man |
17                         sed '
18                                 :a
19                                 /,$/ {
20                                         N
21                                         s/\n//
22                                 }
23                                 ta
24                                 s/[     ]+/ /g' |
25                         grep -i -e '[   *]'$i'\(' | sed 's/^[ +]/       /'
26         }
27 }
28
29 exit 0