9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: Re: [9front] struct(1): struct variant of sig(1)
Date: Mon, 23 Oct 2023 21:39:22 -0400	[thread overview]
Message-ID: <08F483D9C2829AED310A987901F93A28@eigenstate.org> (raw)
In-Reply-To: <6D9DA6FE7D4BF1DA69CE666498E3F49E@eigenstate.org>

Quoth ori@eigenstate.org:
> Quoth Jacob Moody <moody@posixcafe.org>:
> > This is a script I've used for quite a while myself, perhaps useful to others.
> > Got brought up and iterated on a bit today so I figured I would toss it here.
> > 
> > Thanks,
> > moody
> > 
> > 
> > #!/bin/rc
> > 
> > grep -n '^struct[ 	]+'^$1 /sys/include/*.h && \
> > sed -n '/^struct[ 	]+'^$1^'/,/^}/p' /sys/include/*.h
> > grep -l '^struct[ 	]+'^$1 /sys/man/2/* | sed 's;.*/(.*);man 2 \1	# \1(2);'
> 
> maybe add it to sig?
> 
> ...also, sig is way too clever, and therefore you can't do
> 'sig Bread'.
> 

Played with it a bit -- how does this look?

diff 22cf5562fae445333c83d7d562156943dbe1716b uncommitted
--- a/rc/bin/sig
+++ b/rc/bin/sig
@@ -3,13 +3,14 @@
 #	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
+	echo usage: sig name ... >/fd/2
 	exit usage
 }
 
 for (i) {
+	grep -n '^struct[ 	]+'^$i /sys/include/*.h && \
+	sed -n '/^struct[ 	]+'^$i^'/,/^}/p' /sys/include/*.h
 	files=`{grep -il '[ 	]\*?'$i'\(' /sys/man/2/*}
 	for(j in $files) {
 		{echo .nr LL 20i; sed -n '/^.SH SYNOPSIS/,/^.SH.*DESCR/p'  $j } |


      reply	other threads:[~2023-10-24  1:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-13 21:51 Jacob Moody
2023-10-23 23:17 ` ori
2023-10-24  1:39   ` ori [this message]

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=08F483D9C2829AED310A987901F93A28@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    /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).