]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_unix.c
gl_rmain: Nerf bloom intensity. It won't burn your retinas as badly now.
[xonotic/darkplaces.git] / sys_unix.c
index 24ea6482d515ced9dc5262055acfb2bd64e5990e..70e4bd560078da876e16a345aac72a3b54c87be9 100644 (file)
@@ -21,7 +21,9 @@ sys_t sys;
 // =======================================================================
 void Sys_Shutdown (void)
 {
-       fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY);
+#ifndef WIN32
+       fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
+#endif
        fflush(stdout);
 }
 
@@ -31,8 +33,9 @@ void Sys_Error (const char *error, ...)
        char string[MAX_INPUTLINE];
 
 // change stdin to non blocking
-       fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY);
-
+#ifndef WIN32
+       fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
+#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
+               fcntl (sys.outfd, F_SETFL, origflags & ~O_NONBLOCK);
+#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,11 +161,13 @@ int main (int argc, char **argv)
                sys.outfd = 2;
        else
                sys.outfd = 1;
-
-       fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NDELAY);
-
+#ifndef WIN32
+       fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
+#endif
        Host_Main();
 
+       Sys_Quit(0);
+
        return 0;
 }