Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site kontron.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!nsc!voder!kontron!cramer From: cramer@kontron.UUCP (Clayton Cramer) Newsgroups: net.unix-wizards,net.unix,net.wanted,net.dcom Subject: Need Non-Blocking Terminal Input Function For Berkeley 4.2 Message-ID: <482@kontron.UUCP> Date: Wed, 22-Jan-86 13:27:33 EST Article-I.D.: kontron.482 Posted: Wed Jan 22 13:27:33 1986 Date-Received: Fri, 24-Jan-86 10:06:10 EST Distribution: net Organization: Kontron Electronics, Irvine, CA Lines: 18 Xref: watmath net.unix-wizards:16506 net.unix:6910 net.wanted:7997 net.dcom:1627 Does anyone know of a way to do read from a terminal under Berkeley 4.2 UNIX so that after a specified number of seconds control is returned to the program if there is no response? Right now I'm forking off of the main program, and having the child process do the read, with the parent setting an alarm to interrupt the child after a certain number of seconds. This works, but it's devilishly difficult to debug using dbx. Alternate techniques would be appreciated. Please don't suggest using alarm within the same process to interrupt a read -- to quote SIGNAL(3C): If a caught signal occurs during certain system calls, causing the call to terminate prematurely, the call is automatically restarted. In particular, this can occur during a _read_ or _write_(2) on a slow device (such as a terminal; but not a file) and during a _wait_(2). In short, the one time it would be most useful!