blob: d7f7ad237ff6a2f45971de6aa0701e1b4e41cda9 [file] [log] [blame]
rsc47e0a2a2004-10-17 04:02:55 +00001#!/usr/local/plan9/bin/rc
2
3fn 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}
11
12PROMPT='[^ ]*[%;$#][ ]+'
13
14fn cmds {
15 text | 9grep '^'$PROMPT'[^"]' | sed 's/^/ /'
16}
17
18switch($#*) {
19case 0
20 cmds | tail -1
21case *
22 cmds | 9grep '^ '$PROMPT^$"* | {echo; cat} |
23 pr -t -n | sort -nr | sort -u +1 | sort -n |
24 9sed 's/^ *[0-9]+ //' | grep .
25}
26
27# the silly {echo; cat} gets around pr printing "empty file" when
28# presented with no input.
29