cmdline: fix infinite loop after EOF