]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_shared.c
disabled memory clumping, which surprisingly improves memory use, rather than hinders...
[xonotic/darkplaces.git] / sys_shared.c
index 52a28285a16dc86924b02d8a5468bf9c4e9f5534..307c400b9ae62abf8903387d00d665eff664f0fd 100644 (file)
@@ -1,6 +1,10 @@
 
 #include "quakedef.h"
 #include <time.h>
+#ifndef WIN32
+#include <unistd.h>
+#include <fcntl.h>
+#endif
 
 extern cvar_t  timestamps;
 extern cvar_t  timeformat;
@@ -75,45 +79,48 @@ void Sys_Printf (char *fmt, ...)
        if (sys_nostdout)
                return;
 
-       if (timestamps.value)
+       if (timestamps.integer)
        {
                mytime = time (NULL);
                local = localtime (&mytime);
                strftime (stamp, sizeof (stamp), timeformat.string, local);
-               
+
                snprintf (final, sizeof (final), "%s%s", stamp, start);
        }
        else
                snprintf (final, sizeof (final), "%s", start);
 
-       for (p = (unsigned char *) final; *p; p++)
+       // LordHavoc: make sure the string is terminated
+       final[MAX_PRINT_MSG - 1] = 0;
+       for (p = (unsigned char *) final;*p; p++)
                *p = qfont_table[*p];
 #ifdef WIN32
        if (cls.state == ca_dedicated)
-               WriteFile(houtput, final, strlen (final), &dummy, NULL);        
+               WriteFile(houtput, final, strlen (final), &dummy, NULL);
 #else
-       puts(final);
-#endif
-//     for (p = (unsigned char *) final; *p; p++)
-//             putc (qfont_table[*p], stdout);
-#ifndef WIN32
-       fflush (stdout);
+       printf("%s", final);
 #endif
 }
 
-void Sys_Shared_Init(void)
+char engineversion[40];
+
+void Sys_Shared_EarlyInit(void)
 {
-       if (COM_CheckParm("-nostdout"))
-               sys_nostdout = 1;
-       else
-       {
 #if defined(__linux__)
-               fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
-               printf ("DarkPlaces Linux   GL %.2f build %3i", (float) VERSION, buildnumber);
+       sprintf (engineversion, "%s Linux GL build %s", gamename, buildstring);
 #elif defined(WIN32)
-               printf ("DarkPlaces Windows GL %.2f build %3i", (float) VERSION, buildnumber);
+       sprintf (engineversion, "%s Windows GL build %s", gamename, buildstring);
 #else
-               printf ("DarkPlaces Unknown GL %.2f build %3i", (float) VERSION, buildnumber);
+       sprintf (engineversion, "%s Unknown GL build %s", gamename, buildstring);
 #endif
-       }
+
+       if (COM_CheckParm("-nostdout"))
+               sys_nostdout = 1;
+       else
+               printf("%s\n", engineversion);
 }
+
+void Sys_Shared_LateInit(void)
+{
+}
+