9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] sig
@ 2003-07-29 14:47 Rob 'Commander' Pike
  2003-07-29 16:02 ` Dan Cross
  2003-07-29 17:28 ` [9fans] spam script rog
  0 siblings, 2 replies; 4+ messages in thread
From: Rob 'Commander' Pike @ 2003-07-29 14:47 UTC (permalink / raw)
  To: 9fans

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-07-29 20:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-29 14:47 [9fans] sig Rob 'Commander' Pike
2003-07-29 16:02 ` Dan Cross
2003-07-29 20:49   ` boyd, rounin
2003-07-29 17:28 ` [9fans] spam script rog

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).