Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.unix.wizards Subject: Re: friendly messages Message-ID: <3621@ficc.uu.net> Date: 30 Mar 89 15:41:16 GMT References: <435@laic.UUCP> <955@auspex.UUCP> <9218@bloom-beacon.MIT.EDU> <1411@moscom.UUCP> Organization: Xenix Support Lines: 22 Neither of these solutions is correct: In article <1411@moscom.UUCP>, jgp@moscom.UUCP (Jim Prescott) writes: > fprintf(stderr, "%s: %s", Progname, buf); > if (*(buf + strlen(buf) - 1) != '\n') > perror(""); If this is the first time I/O is done, on at least some machines stdio will call isatty(0) to determine if stdout should be unbuffered. It will not save and restore errno. Your program may give such useful advice as: foobar: can't open file barfoo -- Not a typewriter. or: foobar: can't open file barfoo -- Inappropriate ioctl for device. -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Business: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. Personal: ...!texbell!sugar!peter, peter@sugar.hackercorp.com.