input_thread, msg_phys: correct behaviour of readline, added wrapper f-n

I hate readline. Give me an interface to dump stuff into it and control a locked readline(), kay? I was almost going to send bloody signals to the thread and have a signal handler up there going to a goto just to quit it. This problem took way longer than expected to solve. Also, terrible code duplication. Will figure something out. I hated readline too much to deduplicate it.