Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!decwrl!pa.dec.com!shlump.nac.dec.com!lama!suresh From: suresh@lama.enet.dec.com (Suresh Subramanian) Newsgroups: comp.unix.wizards Subject: Some Wizardry in need Keywords: Sockets, Signals. Message-ID: <20238@shlump.nac.dec.com> Date: 14 Feb 91 18:54:26 GMT Sender: newsdaemon@shlump.nac.dec.com Reply-To: suresh@lama.enet.dec.com (Suresh Subramanian) Organization: Digital Equipment Corporation Lines: 52 The scenario goes like this if (!fork()) { fd = socket(.....); /* Unix domain */ bind and listen for connection accept(...) close(0) dup2(fd,0); close(1); dup2(fd,1); close(2); dup2(fd,2); execl("tip", "tip", args, (char *)0); /* standard unix tip, */ } else { sock = socket(...) connect(...); parent process goes on and exits. } (SIGCLD is also installed for notifying child's death) The main program is kind of a supervisor. Keeps waiting for user input and does appropriate actions. The problem I am facing is this:- 1) When a user wants to login to a another machine he calls the above mentioned function. I go ahead and exec tip and wait for tip to make the connection and send me a "login:" prompt. I get it and all goes well. But if the number dialled by tip is a lat then I will not get the standard login prompt. But instead I will get the LAT prompt and tip will be waiting for input from the user. Now the supervisor (that's me) should know that I have to get the input from the user and send it to tip. But I don't know that since I did not get the standard "login: " prompt but a LAT prompt. I cannot forsee all possible lat prompts. An elegant solution would be to get signal from tip, when it is waiting to do IO. I know there is SIGIO to do that. But I have execed tip within a child process. So the function address that I pass to signal system call before execing tip is now meaningless within the tip program. A solution is to modify tip to send SIGIO. But is there any other way to get the job done? Many Thanks for any insight Suresh