9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Rob 'Commander' Pike" <r@google.com>
To: 9fans@cse.psu.edu
Subject: [9fans] sig
Date: Tue, 29 Jul 2003 07:47:47 -0700	[thread overview]
Message-ID: <99aa04dd7ad1d6871bf9e6c515b4f4fc@google.com> (raw)

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



             reply	other threads:[~2003-07-29 14:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29 14:47 Rob 'Commander' Pike [this message]
2003-07-29 16:02 ` Dan Cross
2003-07-29 20:49   ` boyd, rounin
2003-07-29 17:28 ` [9fans] spam script rog

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99aa04dd7ad1d6871bf9e6c515b4f4fc@google.com \
    --to=r@google.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).