-
- com_argc = argc;
- com_argv = (const char **)argv;
-
-#ifdef FNDELAY
- fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
-#endif
+ sys.selffd = -1;
+ sys.argc = argc;
+ sys.argv = (const char **)argv;
+ Sys_ProvideSelfFD();
+
+ // COMMANDLINEOPTION: sdl: -noterminal disables console output on stdout
+ if(COM_CheckParm("-noterminal"))
+ sys.outfd = -1;
+ // COMMANDLINEOPTION: sdl: -stderr moves console output to stderr
+ else if(COM_CheckParm("-stderr"))
+ sys.outfd = 2;
+ else
+ sys.outfd = 1;
+
+ fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NDELAY);