rsc | 47e0a2a | 2004-10-17 04:02:55 +0000 | [diff] [blame] | 1 | #!/usr/local/plan9/bin/rc |
| 2 | |
| 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 | } |
| 11 | |
| 12 | PROMPT='[^ ]*[%;$#][ ]+' |
| 13 | |
| 14 | fn cmds { |
| 15 | text | 9grep '^'$PROMPT'[^"]' | sed 's/^/ /' |
| 16 | } |
| 17 | |
| 18 | switch($#*) { |
| 19 | case 0 |
| 20 | cmds | tail -1 |
| 21 | case * |
| 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 | |