Initial work on handling stdin.

There's still a weird 1-character buffering thing going on that I
can't figure out, but I'm getting off the bus.