2005-01-13 04:56:07 +00:00
|
|
|
#!/usr/local/plan9/bin/rc
|
|
|
|
# Usage: sig key ...
|
|
|
|
# prints out function signatures by grepping the manual
|
|
|
|
|
2005-01-14 05:55:09 +00:00
|
|
|
. 9.rc
|
2005-01-13 04:56:07 +00:00
|
|
|
*=`{echo $*|tr A-Z a-z|tr -dc 'a-z0-9_ \012'} # fold case, delete funny chars
|
|
|
|
if(~ $#* 0){
|
|
|
|
echo Usage: sig function ... >[1=2]
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2008-12-07 00:46:30 +00:00
|
|
|
noplan9=()
|
|
|
|
for(p in $path) {
|
|
|
|
if(! ~ $p $PLAN9/bin)
|
|
|
|
noplan9=($noplan9 $p)
|
|
|
|
}
|
|
|
|
|
2005-01-13 04:56:07 +00:00
|
|
|
for (i) {
|
2005-01-14 05:55:09 +00:00
|
|
|
files=`{grep -il '[ ]\*?'$i'\(' $PLAN9/man/man3/*.3*}
|
2005-01-13 04:56:07 +00:00
|
|
|
for(j in $files) {
|
|
|
|
{echo .nr LL 20i; 9 sed -n '/^.SH SYNOPSIS/,/^.SH.*DESCR/p' $j } |
|
2005-01-14 05:55:09 +00:00
|
|
|
nroff -man |
|
|
|
|
sed '
|
2005-01-13 04:56:07 +00:00
|
|
|
:a
|
|
|
|
/,$/ {
|
|
|
|
N
|
|
|
|
s/\n//
|
|
|
|
}
|
|
|
|
ta
|
|
|
|
s/[ ]+/ /g' |
|
2005-01-14 05:55:09 +00:00
|
|
|
grep -i -e '[ ]\*?'$i'\(' | sed 's/^[ +]/ /'
|
2005-01-13 04:56:07 +00:00
|
|
|
}
|
2008-12-07 00:46:30 +00:00
|
|
|
{ path=$noplan9; man 2 $i; man 3 $i } >[2]/dev/null | nobs | sed -n '
|
|
|
|
:d
|
|
|
|
/SYNOPSIS/bp
|
|
|
|
n
|
|
|
|
bd
|
|
|
|
:p
|
|
|
|
/DESCRIPTION/bd
|
|
|
|
p
|
|
|
|
n
|
|
|
|
bp
|
|
|
|
' | grep -i -e '[ ]\*?'$i'\(' | sed 's/^[ +]/ /'
|
2005-01-13 04:56:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
exit 0
|