sig 530 B

1234567891011121314151617181920212223242526272829
  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 -il '[ ]\*?'$i'\(' /sys/man/2/*}
  11. for(j in $files) {
  12. {echo .nr LL 20i; sed -n '/^.SH SYNOPSIS/,/^.SH.*DESCR/p' $j } |
  13. nroff -man |
  14. sed '
  15. :a
  16. /,$/ {
  17. N
  18. s/\n//
  19. }
  20. ta
  21. s/[ ]+/ /g' |
  22. grep -i -e '[ ]\*?'$i'\(' | sed 's/^[ +]/ /'
  23. }
  24. }
  25. exit 0