summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapropos3
-rwxr-xr-xdef45
-rwxr-xr-xdraw22
-rwxr-xr-xhere2
-rwxr-xr-xm10
-rwxr-xr-xmkdircp8
-rwxr-xr-xmm6
-rwxr-xr-xorig10
-rwxr-xr-xout9
-rwxr-xr-xsummary30
10 files changed, 145 insertions, 0 deletions
diff --git a/apropos b/apropos
new file mode 100755
index 0000000..a0a5c31
--- /dev/null
+++ b/apropos
@@ -0,0 +1,3 @@
+#!/bin/rc -e
+# apropos -- find man pages by name
+man -w $1 | awk -F/ '{ print $NF "(" $(NF-1) ")" }' | mc
diff --git a/def b/def
new file mode 100755
index 0000000..09a3f0c
--- /dev/null
+++ b/def
@@ -0,0 +1,45 @@
+#!/bin/rc -e
+
+# def -- find function definition
+
+flagfmt=a
+args='name [dir]'
+if(! ifs=() eval `{aux/getflags $*} || ! ~ $#* 1 2 3){
+ echo usage: $0 name [dir] >[1=2]
+ exit usage
+}
+
+name=$1
+if(~ $#* 2) wdir=$2
+if not wdir=`{pwd}
+
+files=$wdir^/*.[ch]
+if(~ $files $wdir^/'*.[ch]'){
+ echo error: no c/h files found >[1=2]
+ exit 'not found'
+}
+
+# ansi definition
+if(~ $flaga 1){
+ r=`{
+ echo 'X ,x/[\n ]\**'^$name^'\(.*\)([ ]*\/\*.*\*\/)?\n{/-+=' |
+ sam -d $files >[2=1] |
+ awk -F'[ ;]' '
+ /^ -\. / { file = $3; next }
+ /^ - / { file = $4; next }
+ { print file ":" $1; exit }
+ '}
+}
+
+# style(1) definition
+if not{
+ r=`{grep -n '^'^$name^'\(' $files | awk -F: '{print $1 ":" $2; exit}'}
+}
+
+# success
+if(! ~ $r '')
+ echo $r
+
+# try to find macro instead
+if not
+ grep -n '^#define[ ]'^$name^'\(' $files | awk -F: '{print $1 ":" $2; exit}'
diff --git a/draw b/draw
new file mode 100755
index 0000000..f450741
--- /dev/null
+++ b/draw
@@ -0,0 +1,22 @@
+#!/bin/rc
+
+# draw -- run program in window system's namespace
+
+if(~ $wsys ''){
+ echo $0: '$wsys' not defined >[1=2]
+ exit 'wsys not defined'
+}
+
+flagfmt='a args'
+args='command ...'
+if(! ifs=() eval `{aux/getflags $*}){
+ aux/usage
+ exit usage
+}
+
+rfork n
+unmount /mnt/acme /dev >[2]/dev/null
+unmount $wsys /dev >[2]/dev/null
+mount $wsys /mnt/wsys 'new '$flaga
+bind -b /mnt/wsys /dev
+exec $*
diff --git a/here b/here
new file mode 100755
index 0000000..c8199e8
--- /dev/null
+++ b/here
@@ -0,0 +1,2 @@
+#!/bin/rc
+exec window -cd `{pwd} $*
diff --git a/m b/m
new file mode 100755
index 0000000..1da3add
--- /dev/null
+++ b/m
@@ -0,0 +1,10 @@
+#!/bin/rc -e
+# m -- open man page(s) for command
+m=`{apropos $1}
+n=()
+for(p in $m)
+ if(~ $p *'(1)' *'(4)')
+ n=($n $p)
+if(~ $#n 0)
+ exit 'no manual page'
+plumb $n
diff --git a/mkdircp b/mkdircp
new file mode 100755
index 0000000..2236f24
--- /dev/null
+++ b/mkdircp
@@ -0,0 +1,8 @@
+#!/bin/rc -e
+if(! ~ $#* 2){
+ echo usage: $0 fromdir todir >[1=2]
+ exit usage
+}
+if(! test -d $2)
+ mkdir $2
+exec dircp $1 $2
diff --git a/mm b/mm
new file mode 100755
index 0000000..a0aaca7
--- /dev/null
+++ b/mm
@@ -0,0 +1,6 @@
+#!/bin/rc -e
+# mm -- multi-man
+m=`{apropos $1}
+if(~ $#m 0)
+ exit 'no manual page'
+plumb $m
diff --git a/orig b/orig
new file mode 100755
index 0000000..df991ff
--- /dev/null
+++ b/orig
@@ -0,0 +1,10 @@
+#!/bin/rc
+ifs='
+'
+
+if(! test -d /n/sources/plan9){
+ rfork n
+ 9fs sources
+}
+
+exec plumb /n/sources/plan9`{cleanname -d `{pwd} $1}
diff --git a/out b/out
new file mode 100755
index 0000000..71fb5f0
--- /dev/null
+++ b/out
@@ -0,0 +1,9 @@
+#!/bin/rc
+if(~ $#* 0)
+ f=8.out
+if not
+ f=$1
+if(test -e $f)
+ exec window -cd `{pwd} rc -c 'plumber; exec '^$f
+echo error: $f does not exist >[1=2]
+exit 'file not found'
diff --git a/summary b/summary
new file mode 100755
index 0000000..b527afd
--- /dev/null
+++ b/summary
@@ -0,0 +1,30 @@
+#!/bin/rc -e
+
+flagfmt='o,h,x,a'
+if(! ifs=() eval `{aux/getflags $*}){
+ aux/usage
+ exit usage
+}
+if(~ $#flago$#flagh$#flagx 000){
+ flago=1
+ flagh=1
+}
+
+cat $home/notes | awk '
+ /^ o / { o = o $0 "\n"; mode = "o"; next } # important
+ /^ - / { h = h $0 "\n"; mode = "h"; next } # normal
+ /^ x / { x = x $0 "\n"; mode = "x"; next } # done
+ /^ / {
+ if (! ENVIRON["flaga"]) next
+ if (mode == "o") o = o $0 "\n"
+ if (mode == "h") h = h $0 "\n"
+ if (mode == "x") x = x $0 "\n"
+ next
+ }
+ { mode = "" }
+ END {
+ if (ENVIRON["flago"]) printf "%s", o
+ if (ENVIRON["flagh"]) printf "%s", h
+ if (ENVIRON["flagx"]) printf "%s", x
+ }
+'