* 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
This commit is contained in:
parent
a889fdb955
commit
be26c4f8fd
12
src/main.c
12
src/main.c
|
@ -31,19 +31,31 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
# include <stdlib.h>
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <scheme.h>
|
#include <scheme.h>
|
||||||
|
|
||||||
|
#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) {
|
int main (int ac, char **av) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
AllocConsole ();
|
AllocConsole ();
|
||||||
freopen ("CONIN$", "r", stdin);
|
freopen ("CONIN$", "r", stdin);
|
||||||
freopen ("CONOUT$", "w", stdout);
|
freopen ("CONOUT$", "w", stdout);
|
||||||
freopen ("CONOUT$", "w", stderr);
|
freopen ("CONOUT$", "w", stderr);
|
||||||
|
atexit (exit_handler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Elk_Init (ac, av, 1, "");
|
Elk_Init (ac, av, 1, "");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue