Fix Ctr-C and Ctr-D behavior.

We replace the cmdloop function with a slightly modified version
to achieve standard unix shell behavior on keyboard interupts and EOF.