sig 491 B

12345678910111213141516171819202122
  1. #!/bin/rc
  2. # Usage: sig key ...
  3. # prints out function signatures by grepping the manual
  4. *=`{echo $*|tr A-Z a-z|tr -dc 'a-z0-9_ \012'} # fold case, delete funny chars
  5. if(~ $#* 0){
  6. echo Usage: sig function ... >/fd/2
  7. exit 1
  8. }
  9. for (i) {
  10. files=`{grep -l '[ ]\*?'$i'\(' /sys/man/2/*}
  11. for(j in $files) {
  12. {echo .nr LL 20i; sed -n '/^.SH SYNOPSIS/,/^.SH.*DESCR/p' $j } |
  13. sed 's/[ ]+/ /g;s/^ +//;/^\.nf/d' |
  14. nroff -man |
  15. grep -i -e '[ ]\*?'$i'\(' | sed 's/^[ +]/ /'
  16. }
  17. }
  18. exit 0