Compactified code.
Pulled escape sequence parsing out of the telnetd lib as it was incomplete there (only handled cursor keys; not prepared for long sequences).