Question on implementing "repeat...until keypress"?
guy at gorodish.UUCP
guy at gorodish.UUCP
Mon Feb 9 10:21:26 AEST 1987
(This is NOT a C question, it's an operating system question. C
doesn't know anything about modes for reading lines vs. modes for
reading characters, which is as it should be. I'm redirecting this
to comp.unix.questions, where it belongs.)
> ioctl(0, TIOCGETP, &ttyb);
> ttyb.sg_flags ^= (RAW | ECHO);
> ioctl(0, TIOCSETP, &ttyb);
Is there some reason why this example requires that you:
1) turn off parity checking and generation?
2) disable XON/XOFF flow control?
3) disable the user's interrupt and quit characters?
4) disable all special output processing (such as mapping
newlines to CR/LF)?
If not, then you should be going into CBREAK mode, not RAW mode.
(Two advantages of the S3/S5 terminal driver interface: 1) it
doesn't have CBREAK or RAW mode, so you have to think about what you
want to change, and 2) it's different from the older ones, so you
can't just work from mistaken impressions about what RAW mode really
is.)
RAW mode was intended for binary data transfer, as is used for
up/down loading terminals and the like, UUCP, etc.. (Yes, I know
EMACS uses it, but that's just because the only way to guarantee no
special input processing whatsoever with the older V7-style interface
is to turn RAW mode on.)
The original poster said they were running under S5, so V7/BSD
solutions don't help much. John Plocher's solution is a correct one
for those systems.
More information about the Comp.unix.questions
mailing list