Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.4 $; site uiucuxc Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!whuxl!houxm!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!authorplaceholder From: hamilton@uiucuxc.Uiuc.ARPA Newsgroups: net.bugs.4bsd Subject: Re: Bug in isatty (BSD4.2) Message-ID: <2200010@uiucuxc> Date: Wed, 3-Jul-85 05:17:00 EDT Article-I.D.: uiucuxc.2200010 Posted: Wed Jul 3 05:17:00 1985 Date-Received: Fri, 5-Jul-85 07:41:54 EDT References: <726@mcvax.UUCP> Lines: 35 Nf-ID: #R:mcvax.UUCP:-72600:uiucuxc:2200010:000:733 Nf-From: uiucuxc.Uiuc.ARPA!hamilton Jul 3 04:17:00 1985 regarding the bug in isatty(): this problem has been around as long as isatty() (since V7 at least). my solution: /* * isatty - determine whether a file is a tty * * isatty (file) * int file; * * returns 1 if file descriptor 'file' refers to a tty, 0 otherwise. * differs from the standard version in preserving the value * of "errno" across a potentially erroneous "gtty()". * * last modification: 7 aug 82, j w hamilton * */ #includeextern int errno; isatty (file) int file; { register int olderrno = errno; struct sgttyb ttyb; if (gtty (file, &ttyb) < 0) { errno = olderrno; return (0); } return (1); } wayne ({decvax,ucbvax}!pur-ee!uiucdcs!uiucuxc!)hamilton