fix read_cmdline API and a small buglet where "[comm]" may be too narrow