X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gnushogi%2Frawdsp.c;h=5c4d45dc8a90499f291bac0f2959eefc0d8cd9b5;hb=0a2ec9c1acdcaa2f133f4ee12e478cd710aa4792;hp=e8e7b9809bd026c793f6a1fc6b639989401c8a4d;hpb=a2013afc0b48b5438b7c24ade0ab2dc8979ec3ec;p=gnushogi.git diff --git a/gnushogi/rawdsp.c b/gnushogi/rawdsp.c index e8e7b98..5c4d45d 100644 --- a/gnushogi/rawdsp.c +++ b/gnushogi/rawdsp.c @@ -35,8 +35,10 @@ #include #include #include +#ifndef WIN32 #include #include +#endif #include "gnushogi.h" #include "rawdsp.h" @@ -217,6 +219,10 @@ Raw_Initialize(void) if (XSHOGI) { +#ifdef WIN32 + /* needed because of inconsistency between MSVC run-time system and gcc includes */ + setbuf(stdout, NULL); +#else #ifdef HAVE_SETLINEBUF setlinebuf(stdout); #else @@ -226,6 +232,7 @@ Raw_Initialize(void) # error "Need setlinebuf() or setvbuf() to compile gnushogi!" # endif #endif +#endif printf("GNU Shogi %s\n", PACKAGE_VERSION); } @@ -944,6 +951,11 @@ Raw_ShowPostnValues(void) void Raw_PollForInput(void) { +#ifdef WIN32 + DWORD cnt; + if (!PeekNamedPipe(GetStdHandle(STD_INPUT_HANDLE), NULL, 0, NULL, &cnt, NULL)) + cnt = 1; +#else static struct pollfd pollfds[1] = { /* [0] = */ { /* .fd = */ STDIN_FILENO, /* .events = */ POLLIN } }; int cnt = poll(pollfds, sizeof(pollfds)/sizeof(pollfds[0]), 0); @@ -951,6 +963,7 @@ Raw_PollForInput(void) perror("polling standard input"); ExitShogi(); } +#endif if (cnt) { /* if anything to read, or error occured */ if (!flag.timeout) flag.back = true; /* previous: flag.timeout = true; */