server/telnet: simplify telnet_input function