summaryrefslogtreecommitdiff
path: root/dis
diff options
context:
space:
mode:
authorforsyth <forsyth@vitanuova.com>2009-07-01 00:00:22 +0100
committerforsyth <forsyth@vitanuova.com>2009-07-01 00:00:22 +0100
commita3b744b4ba351c8c7bb51ccc13c60594e073b321 (patch)
treeb09ad0cd17bfac0f6abaf271f6468e203ebe5aa2 /dis
parent403b68d1b65b64b203a7ce3b3eb45066337fa22b (diff)
"20090630-2356"
Diffstat (limited to 'dis')
-rwxr-xr-xdis/sig32
1 files changed, 32 insertions, 0 deletions
diff --git a/dis/sig b/dis/sig
new file mode 100755
index 00000000..cacf7ab0
--- /dev/null
+++ b/dis/sig
@@ -0,0 +1,32 @@
+#!/dis/sh.dis
+# Usage: sig key ...
+# prints out function signatures by grepping the manual
+# stolen from plan 9 via p9p and caerwyn
+load std
+
+x=$*
+*=`{echo $x | tr A-Z a-z | tr -dc 'a-z0-9_ \012'} # fold case, delete funny chars
+if {no $*} {
+ echo Usage: sig function ... >[1=2]
+ exit 1
+}
+
+for i in $* {
+ files=`{grep -il '[ ]*'$i':[ ]*fn\(' /man/2/*}
+ for j in $files {
+ sect=`{basename $j}^'(2)'
+ {echo .nr LL 20i; sed -n '/^.SH SYNOPSIS/,/^.SH.*DESCR/p' $j} |
+# os nroff -man |
+ sed '
+ :a
+ /,$|:$/ {
+ N
+ s/\n//
+ }
+ ta
+ s/[ ]+/ /g' |
+ grep -i '[ ]*'$i':[ ]*fn\(' | sed 's/^[ ]+/ /; s/;$/; \# '$sect'/'
+ }
+}
+
+exit 0