[comp.lang.c] Select and file descriptors ?

Peter_Cutting@newcastle.ac.uk (P. G. Cutting) (09/20/88)

I have written a window manager program (based on curses) which I want to 
start local shells in. I assume that if I could acheive this then the user
could simply rlogin from the shell to do a remote login to some other host.
Lets assume 4.3 for now.

The problem is I dont really know how to do it. Here are my gueses. I think
that the whole thing must revolve around file descriptors, so that I can
sit in a select statement until something happens. For every window I need
a pty. I exec /bin/sh on the slave side. Before this can be done I must
use dup2 so that sh can talk to the slave. I have an example of this in
advanced IPC tutourial but Im not sure what is going on. 

Now the master side of each pty must have its descriptors buried in select.
Or atleast the output side should. ??. There is also the problem of
informing the pty of window size (ioctls I guess).

On the window managers side we have keyboard input going into some
descriptor (/dev/tty,stdin ?? I dont know) which is also buried in the
select statement. Somehow this must get to the right pty based on which
window is selected. 

The output from the ptys should arrive on file dscriptors butried in 
select and from there must be directed to the correct window. 

So Ive got problems. I think the main one is knowing where and how to use
file descriptors. I was wondering if anyone had some example code I could 
take a look at, or recomend a text book, or give me some advice.

Thanks   Peter_Cutting@uk.ac.newcastle 
ARPA	: Peter_Cutting%newcastle.ac.uk@cs.ucl.ac.uk
JANET	: Peter_Cutting@uk.ac.newcastle
UUCP	: PGC@cheviot.UUCP