Reopen stdout in binary mode for -O -.

This commit is contained in:
Micah Cowan 2008-06-01 17:28:44 -07:00
parent b4077ab56a
commit de86fc8c82
2 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2008-06-01 Micah Cowan <micah@cowan.name>
* main.c [WINDOWS]: Reopen stdout in binary mode, when -O - is
given.
2008-05-31 Micah Cowan <micah@cowan.name>
* html-url.c, http.c: Avoid casts in a couple spots.

View File

@ -991,7 +991,19 @@ for details.\n\n"));
if (opt.output_document)
{
if (HYPHENP (opt.output_document))
output_stream = stdout;
{
#ifdef WINDOWS
FILE *result;
result = freopen (NULL, "wb", stdout);
if (result == NULL)
{
logputs (LOG_NOTQUIET, _("\
WARNING: Can't reopen standard output in binary mode;\n\
downloaded file may contain inappropriate line endings.\n"));
}
#endif
output_stream = stdout;
}
else
{
struct_fstat st;