[comp.windows.x] tty subwindow

babu@ctc.fmc.COM (Babu Srinivasan) (12/11/90)

Xview allows only 1 tty subwindow per application. I would like to
create multiple scrollable windows inside a base frame and show the
output of different Unix commands in them. How would I go about doing
this ?

Thanks,

-Babu Srinivasan
babu@ctc.fmc.com

cflatter@ZIA.AOC.NRAO.EDU (Chris Flatters) (12/12/90)

Babu Srinivasan writes:

> Xview allows only 1 tty subwindow per application. I would like to
> create multiple scrollable windows inside a base frame and show the
> output of different Unix commands in them. How would I go about doing
> this ?

One possibility is to set up a text subwindow for each command and
run each command in its own pipe, copying the output to the appropriate
text subwindow.  Pages 385-389 of the XView Programming Manual give
the necessary information.

This will not work for commands that do not write to standard output
(eg. vi).

			Chris Flatters

jimf@SABER.COM (12/12/90)

|> Xview allows only 1 tty subwindow per application. I would like to
|> create multiple scrollable windows inside a base frame and show the
|> output of different Unix commands in them. How would I go about doing
|> this ?
|
|One possibility is to set up a text subwindow for each command and
|run each command in its own pipe, copying the output to the appropriate
|text subwindow.

It's better (and even easier) to make your own tty subwindow stuff.  I
have no idea how Sun managed to make it difficult to do more than one
pty in a single application, I do it all the time.  They must have had
something on their mind at the time.

To do it you need only open a new pty (providing, of course, your
system has ptys) for each tty subwindow you want and add the master
side pty to your list of input descriptors (in Xt that's done with
XtAddInput, I can't remember the SunView method offhand).  Read from
the master side descriptor whenever it has data waiting and copy this
to the text subwindow.  You'll need to make appropriate code to fork
off your application and set up the slave side tty (ie set the pgrp,
tty pgrp and initial tty mode).  Doing that portably is nearly
impossible, I know, but it *can* be done.  A lot of hints can be had
from the xterm sources.

I have a more-or-less portable pty allocator if people want it.  It
doesn't fork off the job and do the slave-side setup (the hard,
nonportable stuff :-) but it's a lot more portable than the standard
BSD code.  With a few minutes hacking it could be turned into
something really nice.

jim frost
saber software
jimf@saber.com