Blob


1 #!/usr/local/plan9/bin/rc
3 fn text {
4 if(~ $winid [0-9]*)
5 9p read acme/$winid/body
6 if not if(~ $text9term unix!*)
7 dial -e $text9term </dev/null
8 if not
9 status=''
10 }
12 PROMPT='[^ ]*[%;$#][ ]+'
14 fn cmds {
15 text | 9 grep '^'$PROMPT'[^"]' | sed 's/^/ /'
16 }
18 switch($#*) {
19 case 0
20 cmds | tail -1
21 case *
22 cmds | 9 grep '^ '$PROMPT^$"* | {echo; cat} |
23 pr -t -n | sort -nr | sort -u +1 | sort -n |
24 9 sed 's/^ *[0-9]+ //' | grep .
25 }
27 # the silly {echo; cat} gets around pr printing "empty file" when
28 # presented with no input.