if isatty() first read from stdin and then grab the keyboard, otherwise first grab...