VINCE@UCONNVM.BITNET (01/03/89)
I need to know how to send initialization information to a program running in a tty-subwindow in suntools. Specifically, I need to set up my own window in order to catch the function keys and make them behave properly. All works except the child which is automatically forked by the tty-subwindow call requires one or two lines of setup information, and I want to do this automatically without having to type it in. The child program takes a bit of time to load, then sends several lines of messages, then waits for input. At that point, and not before, I need to send a short string. After that all works fine. (this is version 3.5) Vince Giambalvo <vince@uconnvm.bitnet>
chuck@trantor.harris-atd.com (Chuck Musciano) (01/07/89)
> I need to know how to send initialization information to a program running > in a tty-subwindow in suntools. [...] The child program takes a bit of time > to load, then sends several lines of messages, then waits for input. At that > point, and not before, I need to send a short string. After that all works > fine. Well, I have had some (distasteful) experiences with this aspect of Sun View. There are several race conditions in the firing up of tty window child processes. The worst one is that the starting of the child is asynchronous with respect to the creation of the containing window. If the child gets up and running, and queries the window size (quite commonly the first thing a lot of programs do), and the window has not yet been rendered on the screen, the size is returned as two random numbers. If the window has been rendered, the size is correct. I tried to fix this by creating and displaying the tty window, and then (via window_set()) specifying the process to run. Unfortunately, the arguments passed to window_create() when the tty window is FIRST CREATED are used to create the child. If you don't supply a process to run, a shell is created by default. So there is no way to create the child sometime after the window has been created. My fix was to fork a stub process which spins, examining the window size until it settles and matches some predetermined value. It then execs the desired child. This is a gross kludge, and I wasn't happy about it. In your case, you can use the ttysw_input() routine to send your commands to the child. They will be queued and delivered when the child does run. There is no way to see the output of the child window, though. I have done this exact thing, and it worked. Read the chapter on tty subwindows in the Sun View manual. Chuck Musciano Advanced Technology Department Harris Corporation (407) 727-6131 ARPA: chuck@trantor.harris-atd.com
zifrony@TAURUS.BITNET (01/13/89)
In Sun-Spots Digest V7n83, Vince Giambalvo <vince@uconnvm.bitnet> asks: >I need to know how to send initialization information to a program running >in a tty-subwindow in suntools.... I think of a few solutions to your problem: 1. Pass the information to the child as arguments using the TTY_ARGV attribute of the tty's window_create. 2. Use a pipe between the SunView program (the father), and the TTY subwindow program (the child), through which the child will notify its parent of its being ready to receive input. Once the message is received by the father, it will send the required input to the TTY subwindow by means of ttysw_input() function. Doron Zifrony E-mail: zifrony@taurus.bitnet or Msc. Student zifrony@Math.Tau.Ac.IL Tel Aviv University Isreal