Replaced in-house TELNET implementation with libtelnet

Clean up a lot of code in comm.cc