Commit Diff


commit - 63853aa06999bf26dd9590b864989f4f3008e694
commit + 47e0a2aa3c6e1ca2b8cd236b934f729fb721baba
blob - /dev/null
blob + d7f7ad237ff6a2f45971de6aa0701e1b4e41cda9 (mode 755)
--- /dev/null
+++ bin/"
@@ -0,0 +1,29 @@
+#!/usr/local/plan9/bin/rc
+
+fn text {
+	if(~ $winid [0-9]*)
+		9p read acme/$winid/body
+	if not if(~ $text9term unix!*)
+		dial -e $text9term </dev/null
+	if not
+		status=''
+}
+
+PROMPT='[^ 	]*[%;$#][ 	]+'
+
+fn cmds {
+	text | 9grep '^'$PROMPT'[^"]' | sed 's/^/	/'
+}
+
+switch($#*) {
+case 0
+	cmds | tail -1
+case *
+	cmds | 9grep '^	'$PROMPT^$"* | {echo; cat} |
+		pr -t -n | sort -nr | sort -u +1 | sort -n |
+		9sed 's/^ *[0-9]+	//' | grep .
+}
+
+# the silly {echo; cat} gets around pr printing "empty file" when
+# presented with no input.
+
blob - /dev/null
blob + 2b1f74446f1c4f17e1c73fc17f9dc090509100ee (mode 755)
--- /dev/null
+++ bin/""
@@ -0,0 +1,10 @@
+#!/usr/local/plan9/bin/rc
+
+PROMPT='[^ 	]*[%;$#][ 	]+'
+
+" $* | tail -1 | tee >{wc -l >/tmp/qq.$pid} | tee /dev/stderr | 9sed 's/^	'$PROMPT'//' | rc
+if(~ `{cat /tmp/qq.$pid} 0){
+	echo no such command found
+	exit notfound
+}
+exit 0