From 621f8f4314d2976687f091419c85e70922adaf8e Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 23 Jan 2019 23:29:57 +0000 Subject: [PATCH] Windows: move dputs back into winmisc.c. Having it in winmiscs.c made it conflict with the one in testcrypt. --- windows/winmisc.c | 27 +++++++++++++++++++++++++++ windows/winmiscs.c | 27 --------------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/windows/winmisc.c b/windows/winmisc.c index be2ea736..abba8085 100644 --- a/windows/winmisc.c +++ b/windows/winmisc.c @@ -405,3 +405,30 @@ void unescape_registry_key(const char *in, strbuf *out) } } } + +#ifdef DEBUG +static FILE *debug_fp = NULL; +static HANDLE debug_hdl = INVALID_HANDLE_VALUE; +static int debug_got_console = 0; + +void dputs(const char *buf) +{ + DWORD dw; + + if (!debug_got_console) { + if (AllocConsole()) { + debug_got_console = 1; + debug_hdl = GetStdHandle(STD_OUTPUT_HANDLE); + } + } + if (!debug_fp) { + debug_fp = fopen("debug.log", "w"); + } + + if (debug_hdl != INVALID_HANDLE_VALUE) { + WriteFile(debug_hdl, buf, strlen(buf), &dw, NULL); + } + fputs(buf, debug_fp); + fflush(debug_fp); +} +#endif diff --git a/windows/winmiscs.c b/windows/winmiscs.c index 1ccd36aa..1fc14d71 100644 --- a/windows/winmiscs.c +++ b/windows/winmiscs.c @@ -16,33 +16,6 @@ void smemclr(void *b, size_t n) { } #endif -#ifdef DEBUG -static FILE *debug_fp = NULL; -static HANDLE debug_hdl = INVALID_HANDLE_VALUE; -static int debug_got_console = 0; - -void dputs(const char *buf) -{ - DWORD dw; - - if (!debug_got_console) { - if (AllocConsole()) { - debug_got_console = 1; - debug_hdl = GetStdHandle(STD_OUTPUT_HANDLE); - } - } - if (!debug_fp) { - debug_fp = fopen("debug.log", "w"); - } - - if (debug_hdl != INVALID_HANDLE_VALUE) { - WriteFile(debug_hdl, buf, strlen(buf), &dw, NULL); - } - fputs(buf, debug_fp); - fflush(debug_fp); -} -#endif - #ifdef MINEFIELD /* * Minefield - a Windows equivalent for Electric Fence