diff options
-rwxr-xr-x | apropos | 3 | ||||
-rwxr-xr-x | def | 45 | ||||
-rwxr-xr-x | draw | 22 | ||||
-rwxr-xr-x | here | 2 | ||||
-rwxr-xr-x | m | 10 | ||||
-rwxr-xr-x | mkdircp | 8 | ||||
-rwxr-xr-x | mm | 6 | ||||
-rwxr-xr-x | orig | 10 | ||||
-rwxr-xr-x | out | 9 | ||||
-rwxr-xr-x | summary | 30 |
10 files changed, 145 insertions, 0 deletions
@@ -0,0 +1,3 @@ +#!/bin/rc -e +# apropos -- find man pages by name +man -w $1 | awk -F/ '{ print $NF "(" $(NF-1) ")" }' | mc @@ -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}' @@ -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 $* @@ -0,0 +1,2 @@ +#!/bin/rc +exec window -cd `{pwd} $* @@ -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 @@ -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 @@ -0,0 +1,6 @@ +#!/bin/rc -e +# mm -- multi-man +m=`{apropos $1} +if(~ $#m 0) + exit 'no manual page' +plumb $m @@ -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} @@ -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' @@ -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 + } +' |