ref: 06ded18ce9088df6aa259598454f804df3f44ff3
dir: /9legacy/quote1_quote2_acme.diff/
--- /dev/null Mon Jun 28 00:12:24 2021 +++ /rc/bin/" Mon Jun 28 16:35:32 2021 @@ -0,0 +1,25 @@ +#!/bin/rc + +rfork en + +PROMPT='[^ ]*(%|;)[ ]+' + +if(test -d /mnt/wsys/acme) + TEXTFILE=/mnt/acme/$winid/body +if not TEXTFILE=/dev/text + +fn cmds { + grep '^'$PROMPT'[^"]' $TEXTFILE | sed 's/^/ /' +} + +switch($#*) { +case 0 + cmds | tail -1 +case * + cmds | grep '^ '$PROMPT^$"* | {echo; cat} | + pr -t -n | sort -nr | sort -u +1 | sort -n | + sed 's/^ *[0-9]+ //' | grep . +} + +# the silly {echo; cat} gets around pr printing "empty file" when +# presented with no input. --- /dev/null Mon Jun 28 00:12:24 2021 +++ /rc/bin/"" Wed Jun 9 08:46:48 2021 @@ -0,0 +1,13 @@ +#!/bin/rc + +PROMPT='[^ ]*(%|;)+[ ]+' + +_x = `{" $* | tail -1} +if(~ $#_x 0) { + echo no such command found >[1=2] + exit notfound +} + +echo ' ' $_x >[1=2] +_x=`{ echo -n 'eval '''; echo $_x | sed 's/^'$PROMPT'//; s/''/''''/g; s/$/''/'} +rc -c $"_x