Fix ANSICON's output when redirected to CON

ANSICON switches the standard streams to Unicode, but uses its own
routine to write directly to the console when appropriate.  However, the
newlines written by -e/-E/-t/-T were still done by the CRT, so when
output was redirected to CON, "\r\0\n\0" was being written.
This commit is contained in:
Jason Hood 2017-10-28 16:43:45 +10:00
parent df5596f65f
commit 97dcb13634
2 changed files with 7 additions and 3 deletions

View File

@ -85,6 +85,9 @@
use Unicode output (_O_U16TEXT, for compilers/systems that support it);
log: 64-bit addresses get an underscore between the 8-digit groups;
add error codes to some message.
v1.80, 28 October, 2017:
write newline with _putws, not putwchar (fixes redirecting to CON).
*/
#define PDATE L"28 October, 2017"
@ -522,7 +525,7 @@ arg_out:
++cmd;
fputws( cmd, stdout );
if (*arg == 'e')
putwchar( '\n' );
_putws( L"" );
}
else // (*arg == 't' || *arg == 'T')
{
@ -536,7 +539,7 @@ arg_out:
{
wprintf( L"==> %s <==\n", arg );
display( arg, title );
putwchar( '\n' );
_putws( L"" );
}
else
display( arg, title );
@ -578,7 +581,7 @@ void display( LPCTSTR name, BOOL title )
}
if (title)
{
putwchar( '\n' );
_putws( L"" );
// Need to flush, otherwise it's written *after* STD_OUTPUT_HANDLE should
// it be redirected.
fflush( stdout );

View File

@ -297,6 +297,7 @@ Version History
1.80 - 28 October, 2017:
- fix unloading;
- fix -e et al when redirecting to CON;
* go back to saving the buffer cursor position.
1.72 - 24 December, 2015: