From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <99aa04dd7ad1d6871bf9e6c515b4f4fc@google.com> To: 9fans@cse.psu.edu From: "Rob 'Commander' Pike" MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] sig Date: Tue, 29 Jul 2003 07:47:47 -0700 Topicbox-Message-UUID: 08caf8b4-eacc-11e9-9e20-41e7f4b1d025 inspired by rog's tweak to lookman, which didn't quite do what i want, i wrote a little script to extract function signatures from the man pages: % sig string auth_respond Point string(Image *dst, Point p, Image *src, Point sp, Font *f, char *s) int auth_respond(void *chal, uint nchal, char *user, uint nuser, void *resp, uint nresp, AuthGetkey *getkey, char *fmt, ...); % i show it below. presotto has installed an earlier version, soon to be updated, on sources. you'll also want to sync against sources because the draw(2) man page had a silliness that stopped sig working right on it, which is also fixed there. enjoy -rob #!/bin/rc # Usage: sig key ... # prints out function signatures by grepping the manual *=`{echo $*|tr A-Z a-z|tr -dc 'a-z0-9_ \012'} # fold case, delete funny chars if(~ $#* 0){ echo Usage: sig function ... >/fd/2 exit 1 } for (i) { files=`{grep -l '[ ]\*?'$i'\(' /sys/man/2/*} for(j in $files) { {echo .nr LL 20i; sed -n '/^.SH SYNOPSIS/,/^.SH.*DESCR/p' $j } | sed 's/[ ]+/ /g;s/^ +//;/^\.nf/d' | nroff -man | grep -i -e '[ ]\*?'$i'\(' | sed 's/^[ +]/ /' } } exit 0