From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14289 invoked from network); 24 Oct 2023 01:45:46 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 24 Oct 2023 01:45:46 -0000 Received: from mimir.eigenstate.org ([206.124.132.107]) by 9front; Mon Oct 23 21:39:26 -0400 2023 Received: from abbatoir (pool-108-6-24-2.nycmny.fios.verizon.net [108.6.24.2]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id dfcc5a93 (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Mon, 23 Oct 2023 18:39:23 -0700 (PDT) Message-ID: <08F483D9C2829AED310A987901F93A28@eigenstate.org> To: 9front@9front.org Date: Mon, 23 Oct 2023 21:39:22 -0400 From: ori@eigenstate.org In-Reply-To: <6D9DA6FE7D4BF1DA69CE666498E3F49E@eigenstate.org> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: secure SQL wrapper grid Subject: Re: [9front] struct(1): struct variant of sig(1) Reply-To: 9front@9front.org Precedence: bulk Quoth ori@eigenstate.org: > Quoth Jacob Moody : > > 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 } |