Berkely unix (4.2) tty ioctl question
Chris Torek
chris at umcp-cs.UUCP
Fri Sep 21 23:58:00 AEST 1984
If you do a TIOCSETP, that will wait for the output to drain; you
can then do TIOCSETC and SLTC and whatever else. So you might do
something like this:
/* Change the terminal characters (start, stop, etc) after the output
has drained. Since 4.2 doesn't provide a set-after-wait ioctl for
struct tchars, we have to use TIOCSETP to allow the output to drain.
To do this we need a TIOCGETP so that we don't actually change
anything. Furthermore, someone should ensure that all this is done
only in the foreground so that we don't get stopped and maybe have
the tty characteristics change between the GETP and the SETP. */
SetCharsAfterWait (fd, t)
int fd;
struct tchars *t;
{
struct sgttyb sg;
(void) ioctl (fd, TIOCGETP, &sg);
(void) ioctl (fd, TIOCSETP, &sg);
(void) ioctl (fd, TIOCSETC, t);
}
--
(This page accidently left blank.)
In-Real-Life: Chris Torek, Univ of MD Comp Sci (301) 454-7690
UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at maryland
More information about the Comp.unix
mailing list