mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Use STDOUT when no filename is specified and we detect stdout is not going to the terminal.
This commit is contained in:
parent
6ddd2e8e7e
commit
77f17857e7
6
main.c
6
main.c
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue