Also write \r to stdout on Windows if it is the last character to be written. Flush stdout afterwards so that frontends (e.g. mmg) receive the output immediately.

This commit is contained in:
Moritz Bunkus 2005-08-17 15:28:47 +00:00
parent 0bdb3d83c2
commit 5833f47656

View File

@ -1167,10 +1167,11 @@ mm_stdio_c::write(const void *buffer,
bytes_written = 0; bytes_written = 0;
s = (const char *)buffer; s = (const char *)buffer;
for (i = 0; i < size; ++i) for (i = 0; i < size; ++i)
if (('\r' != s[i]) || if (('\r' != s[i]) || ((i + 1) == size) || ('\n' != s[i + 1]))
(((i + 1) < size) && ('\n' != s[i + 1])))
bytes_written += fwrite(&s[i], 1, 1, stdout); bytes_written += fwrite(&s[i], 1, 1, stdout);
fflush(stdout);
return bytes_written; return bytes_written;
#else // defined(SYS_WINDOWS) #else // defined(SYS_WINDOWS)