From 51971ce6c7ff878be0f6eb0858aa1f5e71d7dd4e Mon Sep 17 00:00:00 2001 From: bel Date: Thu, 13 Mar 2014 21:41:17 +0100 Subject: [PATCH] Show 'usage' information on console also for Windows --- src/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main.c b/src/main.c index 00f2dd83..404dd01c 100644 --- a/src/main.c +++ b/src/main.c @@ -134,6 +134,15 @@ static void show_usage_and_exit(void) const struct mg_option *options; int i; +#ifdef WIN32 + if (!AttachConsole(ATTACH_PARENT_PROCESS)) { + AllocConsole(); + AttachConsole(GetCurrentProcessId()); + } + freopen("CON", "a", stdout); + freopen("CON", "a", stderr); +#endif + fprintf(stderr, "Civetweb v%s, built on %s\n", mg_version(), __DATE__); fprintf(stderr, "Usage:\n");