Fix output in the login command

It was broken because the terminal is in raw mode.

This changeset adds code in the login commmand to do a little bit of
interpretation on the user input (something usually done by the terminal
emulator itself).
Merge remote-tracking branch 'lopter/master'