peter@ficc.ferranti.com (Peter da Silva) (08/07/90)
This is touched on in the latest FAQ for comp.unix.questions, under "how do I tell if my program is running in the background". It is not a C problem, but a UNIX problem. However, here are the answers. In article <12210@hydra.gatech.EDU> gg10@prism.gatech.EDU (GALLOWAY) writes: > If I have a program named "foo" which can accept standard input if no file > name exists on the command line, and the user just types "foo", I want to > display usage. if(isatty(fileno(stdin))) { usage(); exit(0); } > It would also be nice, if the output of "foo" was no ASCII to display a > message like "foo: output must not be terminal". if(isatty(fileno(stdout))) { user_error(); usage(); exit(2); } -- Peter da Silva. `-_-' +1 713 274 5180. 'U` <peter@ficc.ferranti.com>