Fixed a few bugs in cmdline interpreter, and added read_pipe_input for cmdline.