]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - console.c
now supports Mac and Windows newlines everywhere
[xonotic/darkplaces.git] / console.c
index 8bac0735464d854d605e2fc3853b912d0e4ed154..0dfcba8abb7eb9796685f617205185319ef5fab8 100644 (file)
--- a/console.c
+++ b/console.c
@@ -72,7 +72,6 @@ LOGGING
 */
 
 cvar_t log_file = {0, "log_file",""};
-cvar_t log_sync = {0, "log_sync","0"};
 char crt_log_file [MAX_OSPATH] = "";
 qfile_t* logfile = NULL;
 
@@ -121,15 +120,11 @@ void Log_Init (void)
        logq_ind = 0;
 
        Cvar_RegisterVariable (&log_file);
-       Cvar_RegisterVariable (&log_sync);
 
        // support for the classic Quake option
-// COMMANDLINEOPTION: Console: -condebug logs console messages to qconsole.log with sync on (so it keeps every message up to a crash), see also log_file and log_sync
+// COMMANDLINEOPTION: Console: -condebug logs console messages to qconsole.log, see also log_file
        if (COM_CheckParm ("-condebug") != 0)
-       {
                Cvar_SetQuick (&log_file, "qconsole.log");
-               Cvar_SetValueQuick (&log_sync, 1);
-       }
 }
 
 
@@ -143,7 +138,7 @@ void Log_Open (void)
        if (logfile != NULL || log_file.string[0] == '\0')
                return;
 
-       logfile = FS_Open (log_file.string, "at", false);
+       logfile = FS_Open (log_file.string, "ab", false);
        if (logfile != NULL)
        {
                strlcpy (crt_log_file, log_file.string, sizeof (crt_log_file));
@@ -201,10 +196,12 @@ Log_ConPrint
 void Log_ConPrint (const char *msg)
 {
        static qboolean inprogress = false;
+
        // don't allow feedback loops with memory error reports
        if (inprogress)
                return;
        inprogress = true;
+
        // Until the host is completely initialized, we maintain a log queue
        // to store the messages, since the log can't be started before
        if (logqueue != NULL)
@@ -241,31 +238,11 @@ void Log_ConPrint (const char *msg)
 
        // If a log file is available
        if (logfile != NULL)
-       {
                FS_Print (logfile, msg);
-               if (log_sync.integer)
-                       FS_Flush (logfile);
-       }
        inprogress = false;
 }
 
 
-/*
-================
-Log_Print
-================
-*/
-void Log_Print (const char *logfilename, const char *msg)
-{
-       qfile_t *file;
-       file = FS_Open(logfilename, "at", true);
-       if (file)
-       {
-               FS_Print(file, msg);
-               FS_Close(file);
-       }
-}
-
 /*
 ================
 Log_Printf
@@ -275,7 +252,7 @@ void Log_Printf (const char *logfilename, const char *fmt, ...)
 {
        qfile_t *file;
 
-       file = FS_Open (logfilename, "at", true);
+       file = FS_Open (logfilename, "ab", true);
        if (file != NULL)
        {
                va_list argptr;
@@ -800,9 +777,9 @@ void Con_DrawNotify (void)
                if (gamemode == GAME_NEXUIZ) {
                        int linewidth;
 
-                       for (linewidth = con_linewidth; text[--linewidth] == ' ' && linewidth; linewidth--);
-                       x = (vid.conwidth - ++linewidth * 8) / 2;
-               } else 
+                       for (linewidth = con_linewidth; linewidth && text[linewidth-1] == ' '; linewidth--);
+                       x = (vid.conwidth - linewidth * 8) / 2;
+               } else
                        x = 0;
 
                DrawQ_String(x, v, text, con_linewidth, 8, 8, 1, 1, 1, 1, 0);