9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] struct(1): struct variant of sig(1)
@ 2023-10-13 21:51 Jacob Moody
  2023-10-23 23:17 ` ori
  0 siblings, 1 reply; 3+ messages in thread
From: Jacob Moody @ 2023-10-13 21:51 UTC (permalink / raw)
  To: 9front

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);'

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

* Re: [9front] struct(1): struct variant of sig(1)
  2023-10-13 21:51 [9front] struct(1): struct variant of sig(1) Jacob Moody
@ 2023-10-23 23:17 ` ori
  2023-10-24  1:39   ` ori
  0 siblings, 1 reply; 3+ messages in thread
From: ori @ 2023-10-23 23:17 UTC (permalink / raw)
  To: 9front

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'.


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

* Re: [9front] struct(1): struct variant of sig(1)
  2023-10-23 23:17 ` ori
@ 2023-10-24  1:39   ` ori
  0 siblings, 0 replies; 3+ messages in thread
From: ori @ 2023-10-24  1:39 UTC (permalink / raw)
  To: 9front

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 } |


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

end of thread, other threads:[~2023-10-24  1:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-13 21:51 [9front] struct(1): struct variant of sig(1) Jacob Moody
2023-10-23 23:17 ` ori
2023-10-24  1:39   ` ori

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).