Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site eagle.UUCP Path: utzoo!watmath!clyde!burl!ulysses!eagle!mjs From: mjs@eagle.UUCP (M.J.Shannon) Newsgroups: net.bugs.4bsd Subject: Re: Bug in isatty (errno setting/clearing) Message-ID: <1308@eagle.UUCP> Date: Sat, 3-Aug-85 11:17:28 EDT Article-I.D.: eagle.1308 Posted: Sat Aug 3 11:17:28 1985 Date-Received: Sun, 4-Aug-85 08:48:51 EDT References: <965@sdcsvax.UUCP> <2200011@uiucuxc> <304@celerity.UUCP> Organization: AT&T Bell Laboratories, Summit, NJ Lines: 53 > In article <2200011@uiucuxc> hamilton@uiucuxc.Uiuc.ARPA writes: > > > >> MY 4.2bsd manual says: > >> ... An > >> error number is also made available in the external variable > >> _errno_, which is not cleared on successful calls. Thus _errno_ > >> should be tested only after an error has occurred. > >> > > notice that that quote is from intro(2), while the functions > >causing all this ruckus are from section 3, and intro(3) mentions > >errno only in the context of math functions. i don't want to dig > >out my V6 manuals, but i'm fairly sure errno used to be exclusively > >maintained by the system call interface functions. > > wayne ({decvax,ucbvax}!pur-ee!uiucdcs!uiucuxc!)hamilton > > I got out MY V6 manuals and the following is a quote from the getc(III) > > DIAGNOSTICS > c-bit is set on EOF or error; from C, negative return indicates > EOF. Moreover, 'errno' is set by this routine just as it is for > a system call (see introduction (II)). > > Also putc, putw, fcreat, fflush, all happen to munge errno, as necessary. > > So in V6, we have errno munged by the library routines in section 3. > -- > David Barto, Celerity Computing, San Diego Ca, (619) 271-9940 Some things to ponder before you use the f(lame|ollowup) key: V6 had no stdio library (it *did* have a "portable C library", which stdio was (loosely) based on). I doubt that the person who started the original discussion is using V6, so the comments about obsolete function semantics is only of historical interest. The 4.2BSD manual (as quoted above) *explicitly* defines the semantics of errno. To wit, "Thus, errno should be tested only after an error has occurred." The manual for the system in use is the only one applicable to the question at hand. Different versions of the system behave differently (is *anyone* surprised at this?). The question at hand has been fully answered and explained. Can we now move on to something more serious? -- Marty Shannon UUCP: ihnp4!eagle!mjs Phone: +1 201 522 6063 Warped people are throwbacks from the days of the United Federation of Planets.