friendly messages

Peter da Silva peter at ficc.uu.net
Fri Mar 31 01:41:16 AEST 1989


Neither of these solutions is correct:

In article <1411 at moscom.UUCP>, jgp at 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 at ficc.uu.net, +1 713 274 5180.
Personal: ...!texbell!sugar!peter, peter at sugar.hackercorp.com.



More information about the Comp.unix.wizards mailing list