Timed-out Input
Brett Joseph Vickers
bvickers at paris.ics.uci.edu
Sat Feb 17 16:53:56 AEST 1990
Greetings,
I have written a program using Xenix SysV and I am in the process of porting
it over to BSD, but I've hit a glitch. The glitch occurs with my input
processing. In the SysV version, I was using the termio structure to
set a key-in timeout (termio.c_cc[VTIME]=3;). But when I moved over to BSD
I was forced to use the sgttyb structure in conjunction with the ioctl()
call. So far, I'm using the CBREAK mode, but this alone does not allow
me to "time out" my inputs.
Here is what I had in the System V version:
foo()
{
struct termio temp; /* Using termio */
ioctl(0,TCGETA,&temp);
temp.clflag &= ~(ICANON);
temp.c_cc[VMIN] = 0;
temp.c_cc[VTIME] = 3; /* Time out after .3 seconds */
ioctl(0,TCSETA,&temp);
}
And what I've got in the BSD version:
bar()
{
struct sgttyb temp;
ioctl(0,TIOCGETP,&temp);
temp.sg_flags |= CBREAK;
ioctl(0,TIOCSETP,&temp);
}
As you can see, I know of no way to time out raw or cbreaked input.
Is there a way to do this with BSD?
Thank you,
bvickers at bonnie.ics.uci.edu
More information about the Comp.unix.questions
mailing list