Help me fiddle the console
Dave Gagne
daveg at coho.UUCP
Tue Nov 22 04:22:54 AEST 1988
I have a graphics-based application which currently MUST run directly
from the console - ie: it CAN'T run under suntools. Unfortunately,
this means that any console messages print out all over the screen,
wiping out stuff, and generally mucking up the graphics. The
application does have a screen refresh command, but it is a real pain
to have to refresh the screen every 2-3 minutes (Yes, we DO get a lot
of console messages: mostly things like "ie1: spurious interrupt").
The program accepts input both from mouse inputs and from the keyboard.
Keyboard commands can be single key short commands (like vi's command
mode) or full newline terminated strings.
What I would like to do is run a C program which grabs all console
output console and redirects it somewhere: to /dev/null or maybe to a
file. I have been using the command sequence:
int on;
int tty, pty;
. . .
pty = open ("/dev/ptyqf", O_RDWR);
if (pty == -1)
SystemError ("pty not opened");
tty = open ("/dev/ttyqf", O_RDWR);
if (tty == -1)
SystemError ("tty not opened");
on = 1;
if (ioctl (tty, TIOCCONS, &on) == -1)
SystemError ("ioctl failed");
My intention was to direct the console output to the pseudo-tty pair,
so console messages don't come out on the screen. This much seems to
work, the messages no longer appear (and they get logged to the file
I specified).
The PROBLEM is that INPUT is redirected as well: it now comes from the
pseudo-tty (I think). In any case, I can no longer enter commands from
the keyboard, and have the application see them. In other words, input
cannot come directly from the console keyboard.
What I want to know is how can I redirect the console output messages
to a file, but keep the input attached to the process?
--
+---------------------------------------------------------------------------+
| Dave Gagne. UBC VLSI Salmon Net o /\ /\ |
| _____ o \ / \ |
| daveg at ee.ubc.ca \/ o\_o \ / \ |
| ...!ubc-vision!ee.ubc.ca!daveg /\_____/ \ / \ |
| daveg at ee.ubc.cdn%ean.ubc.ca at RELAY.CSNET \/ \ |
+---------------------------------------------------------------------------+
More information about the Comp.unix.questions
mailing list