Quote:
No. By block mysteriously, I mean, block on more than one character even when vmin=1. I wasn't able to get "proper" behavior as you describe it, and don't want to give someone "compliant" yet broken code.
The proper behavior is to wait for one character. I have used this construct (~ICANON|ECHO, VMIN=1, VTIME=0) on tons of systems (Linux, *BSD, OSX, AIX, Tru64 and Digital UNIX, IRIX, HP-UX, UnixWare) as well as Cygwin and it always worked as expected. It is standard, documented and it works.
Did you try the exact code Jim posted with the only change being VMIN=1?
Blocking "mysteriously" in noncanonical mode after tcsetattr() usually happens if you DON'T set VMIN, in which case some systems such as IRIX and (I think) Solaris default to VMIN=4, whereas Linux and BSD default to 1. But then they only block until you entered 4 chars.
I labeled the select() solution a kludge because it seemed an unnecessarily contrived solution if you're setting VMIN to 1, since the read operation will block until 1 char has been read and no timeout was indended.