Use STDOUT when no filename is specified and we detect stdout is not going to the terminal.

This commit is contained in:
ckolivas 2011-04-20 11:56:02 +10:00
parent 6ddd2e8e7e
commit 77f17857e7

6
main.c
View file

@ -727,8 +727,10 @@ int main(int argc, char *argv[])
register_outputfile(control.msgout); register_outputfile(control.msgout);
} }
/* If we're using stdin and no output filename, use stdout */ /* If no output filename is specified, and we're using stdin,
if (STDIN && !control.outname) { * or we detect that stdout is not going to the terminal,
* use stdout */
if (!control.outname && (STDIN || !isatty(fileno((FILE *)stdout)))) {
control.flags |= FLAG_STDOUT; control.flags |= FLAG_STDOUT;
control.msgout = stderr; control.msgout = stderr;
register_outputfile(control.msgout); register_outputfile(control.msgout);