terminal buffer...
Mike Marshall
hubcap at hubcap.UUCP
Thu Mar 3 00:41:03 AEST 1988
Hi -
here's a chunk of code from a program I once wrote... what is does is
send an x-off to a terminal. I was using it to store up unredirectable
stuff (like the output of mt, which is written directly to the controlling
terminal, not stdout) in the terminal's output buffer (where ever that is)
so that I could throw it away (by using ioctl to cram a buffer-flush char
into the output stream, prior to sending an x-on). That works great, but
now I wish my program could look at the stuff before I throw it away.
Does anyone know how I might be able to look at the stuff stored in the
terminal's output buffer? I didn't see any ioctls
that would let me do that, but maybe I just didn't understand what the
manual was telling me...
thanks...
Mike Marshall hubcap at hubcap.clemson.edu ...!hubcap!hubcap
/*
. send an XOFF to tty associated with this process...
*/
xoff(tty)
int tty;
{
struct tchars t;
/* get the terminal's special character set... */
if (ioctl(tty,(int)TIOCGETC,(char *)&t) == -1) {
puts("ratmaw: unable to determine tty special chars. goodbye.");
exit(-1);
}
/* send the XOFF... */
if (ioctl(tty,(int)TIOCSTI,(char *)&t.t_stopc) == -1) {
puts("ratmaw: unable to XOFF. goodbye.");
exit(-1);
}
}
More information about the Comp.unix.wizards
mailing list