lint question

Peter da Silva peter at ficc.uu.net
Thu Jan 12 07:56:21 AEST 1989


In article <9332 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn ) writes:
> In article <2679 at ficc.uu.net> peter at ficc.uu.net (Peter da Silva) writes:
> >	if(fprintf(stderr, "...: operation failed\n") == FAIL) {
> >		if(!(fp = fopen("/dev/tty", "w"))) {
> >			if(!(fp = fopen("/dev/console", "w"))) {

> Not really, because if somebody has redirected stderr it is probably
> for a good reason, and such policy should not be overridden by an
> application that doesn't know what's going on outside.  Blathering
> on the console is particularly obnoxious in most cases.

You're right. I should probably have included a reference to "/dev/smiley"
in there. Blathering to "/dev/tty" is a different matter. If you can't open
/dev/tty, then something is pretty wrong. What happens if you do this:

	fclose(stdin); fclose(stdout); fclose(stderr);
	setpgrp();
	if(!(fp = fopen("/dev/tty", "w+"))) {
		...
	}

But for an application (like a modem callback program) that DOES know what's
going on outside might be perfectly justified in blathering on the console.
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.
Work: uunet.uu.net!ficc!peter, peter at ficc.uu.net, +1 713 274 5180.   `-_-'
Home: bigtex!texbell!sugar!peter, peter at sugar.uu.net.                 'U`
Opinions may not represent the policies of FICC or the Xenix Support group.



More information about the Comp.lang.c mailing list