From be26c4f8fdef775bb43714ecf0d3ed4f7d91f5f7 Mon Sep 17 00:00:00 2001 From: sam Date: Thu, 11 Sep 2003 10:09:27 +0000 Subject: [PATCH] * Allocate a console under Win32, and wait for user input before closing it. git-svn-id: svn://svn.zoy.org/elk/trunk@145 55e467fa-43c5-0310-a8a2-de718669efc6 --- src/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.c b/src/main.c index 2a164f8..2603e7b 100644 --- a/src/main.c +++ b/src/main.c @@ -31,19 +31,31 @@ #include "config.h" #ifdef WIN32 +# include # include #endif #include +#ifdef WIN32 +static void exit_handler () { + fprintf (stdout, "\nElk has terminated. Press return to continue.\n"); + fflush (stdin); + getchar (); +} +#endif + int main (int ac, char **av) { #ifdef WIN32 AllocConsole (); freopen ("CONIN$", "r", stdin); freopen ("CONOUT$", "w", stdout); freopen ("CONOUT$", "w", stderr); + atexit (exit_handler); #endif + Elk_Init (ac, av, 1, ""); + return 0; }