Mercurial > repos > blastem
comparison terminal_win.c @ 832:0433fdd9ba66
Added a command line option to force BlastEm to not open a new terminal even if it detects that stdin/out are not terminals
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 19 Oct 2015 19:16:28 -0700 |
parents | 1af7d1cdcc66 |
children |
comparison
equal
deleted
inserted
replaced
831:079eb395ddd1 | 832:0433fdd9ba66 |
---|---|
1 #include <windows.h> | 1 #include <windows.h> |
2 #include <stdio.h> | 2 #include <stdio.h> |
3 | 3 |
4 static char init_done; | |
5 | |
6 void force_no_terminal() | |
7 { | |
8 init_done = 1; | |
9 } | |
10 | |
4 void init_terminal() | 11 void init_terminal() |
5 { | 12 { |
6 static char init_done; | |
7 if (!init_done) { | 13 if (!init_done) { |
8 AllocConsole(); | 14 AllocConsole(); |
9 freopen("CONIN$", "r", stdin); | 15 freopen("CONIN$", "r", stdin); |
10 freopen("CONOUT$", "w", stdout); | 16 freopen("CONOUT$", "w", stdout); |
11 freopen("CONOUT$", "w", stderr); | 17 freopen("CONOUT$", "w", stderr); |
18 init_done = 1; | |
12 } | 19 } |
13 } | 20 } |