From: cloudwalk Date: Sat, 4 Jul 2020 14:09:37 +0000 (+0000) Subject: Fix Windows build of sys_unix.c X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=efa1b13f3b4e1b512309d16f51d1e2e28d32c013 Fix Windows build of sys_unix.c git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12786 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/sys_unix.c b/sys_unix.c index 24ea6482..09929a37 100644 --- a/sys_unix.c +++ b/sys_unix.c @@ -21,7 +21,9 @@ sys_t sys; // ======================================================================= void Sys_Shutdown (void) { +#ifndef WIN32 fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY); +#endif fflush(stdout); } @@ -31,8 +33,9 @@ void Sys_Error (const char *error, ...) char string[MAX_INPUTLINE]; // change stdin to non blocking +#ifndef WIN32 fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY); - +#endif va_start (argptr,error); dpvsnprintf (string, sizeof (string), error, argptr); va_end (argptr); @@ -50,9 +53,10 @@ void Sys_PrintToTerminal(const char *text) // BUG: for some reason, NDELAY also affects stdout (1) when used on stdin (0). // this is because both go to /dev/tty by default! { +#ifndef WIN32 int origflags = fcntl (sys.outfd, F_GETFL, 0); fcntl (sys.outfd, F_SETFL, origflags & ~O_NDELAY); -#ifdef WIN32 +#else #define write _write #endif while(*text) @@ -62,7 +66,9 @@ void Sys_PrintToTerminal(const char *text) break; // sorry, I cannot do anything about this error - without an output text += written; } +#ifndef WIN32 fcntl (sys.outfd, F_SETFL, origflags); +#endif } //fprintf(stdout, "%s", text); } @@ -155,9 +161,9 @@ int main (int argc, char **argv) sys.outfd = 2; else sys.outfd = 1; - +#ifndef WIN32 fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NDELAY); - +#endif Host_Main(); return 0;