Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site hadron.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!pyramid!ut-sally!seismo!rlgvax!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: net.unix-wizards Subject: Re: Printf sets errno to 25? Message-ID: <146@hadron.UUCP> Date: Wed, 25-Dec-85 17:49:07 EST Article-I.D.: hadron.146 Posted: Wed Dec 25 17:49:07 1985 Date-Received: Sat, 28-Dec-85 01:02:46 EST References: <119@cpsc6a.UUCP> <212@iclbra.UUCP> <952@brl-tgr.ARPA> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Distribution: net Organization: Hadron, Inc., Fairfax, VA Lines: 11 Keywords: isatty, printf, ENOTTY Summary: printf() does check tty-ness. As Gwyn and Merritt point out, the value of errno is not guaranteed to be meaningful except under certain circumstances, e.g., failed system calls. The reason it gets set at all inside printf() is that printf() checks stdout for tty-ness and, if it is not a tty, buffers output. Otherwise, depending on the version of UNIX, it line-buffers it or does not buffer it at all. Again depending on the version of UNIX, roughly the same may be true of stdin. I believe (and I know Doug'll hit me if I'm wrong) that stderr is always unbuffered. -- Joe Yao hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}