diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/winansi.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index 8ec75a4e4..3767e7534 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #undef printf | 14 | #undef printf |
15 | #undef fprintf | 15 | #undef fprintf |
16 | #undef fputs | 16 | #undef fputs |
17 | #undef fputc | ||
17 | #undef putchar | 18 | #undef putchar |
18 | #undef fwrite | 19 | #undef fwrite |
19 | #undef puts | 20 | #undef puts |
@@ -635,7 +636,7 @@ int winansi_putchar(int c) | |||
635 | return putchar(c); | 636 | return putchar(c); |
636 | 637 | ||
637 | CharToOemBuff(s, s, 1); | 638 | CharToOemBuff(s, s, 1); |
638 | return putchar(t) == EOF ? EOF : c; | 639 | return putchar(t) == EOF ? EOF : (unsigned char)c; |
639 | } | 640 | } |
640 | 641 | ||
641 | int winansi_puts(const char *s) | 642 | int winansi_puts(const char *s) |
@@ -720,6 +721,23 @@ int winansi_fputs(const char *str, FILE *stream) | |||
720 | return ansi_emulate(str, stream) == EOF ? EOF : 0; | 721 | return ansi_emulate(str, stream) == EOF ? EOF : 0; |
721 | } | 722 | } |
722 | 723 | ||
724 | int winansi_fputc(int c, FILE *stream) | ||
725 | { | ||
726 | int ret; | ||
727 | char t = c; | ||
728 | char *s = &t; | ||
729 | |||
730 | if (!is_console(fileno(stream))) { | ||
731 | SetLastError(0); | ||
732 | if ((ret=fputc(c, stream)) == EOF) | ||
733 | check_pipe(stream); | ||
734 | return ret; | ||
735 | } | ||
736 | |||
737 | CharToOemBuff(s, s, 1); | ||
738 | return fputc(t, stream) == EOF ? EOF : (unsigned char )c; | ||
739 | } | ||
740 | |||
723 | #if !defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO | 741 | #if !defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO |
724 | /* | 742 | /* |
725 | * Prior to Windows 10 vsnprintf was incompatible with the C99 standard. | 743 | * Prior to Windows 10 vsnprintf was incompatible with the C99 standard. |