Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!iuvax!rutgers!bellcore!texbell!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: lint question Message-ID: <2699@ficc.uu.net> Date: 11 Jan 89 21:56:21 GMT References: <491@babbage.acc.virginia.edu> <9322@smoke.BRL.MIL> <2679@ficc.uu.net> <9332@smoke.BRL.MIL> Organization: Xenix Support Lines: 28 In article <9332@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn ) writes: > In article <2679@ficc.uu.net> peter@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@ficc.uu.net, +1 713 274 5180. `-_-' Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net. 'U` Opinions may not represent the policies of FICC or the Xenix Support group.