rendered paste bodyint main (int argc, char **argv)
{
int time, oldtime, newtime;
float timescale = 1.0;
/* go back to real user for config loads */
saved_euid = geteuid();
seteuid(getuid());
Qcommon_Init(argc, argv);
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
nostdout = Cvar_Get("nostdout", "0", 0, NULL);
if (!nostdout->value) {
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
}
newtime = Sys_Milliseconds();
while (sys_play) {
/* find time spent rendering last frame */
oldtime = newtime;
newtime = Sys_Milliseconds();
time = timescale * (newtime - oldtime);
timescale = Qcommon_Frame(time);
}
SV_Shutdown("Server quit\n", qfalse);
#ifndef DEDICATED_ONLY
CL_Shutdown();
#else
Cvar_WriteVariables(va("%s/config.cfg", FS_Gamedir()));
#endif
printf("--1\n");
CL_Shutdown ();
printf("--2\n");
Qcommon_Shutdown ();
printf("--3\n");
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
printf("--4\n");
return 0;
}