]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cmd.c
now supports Mac and Windows newlines everywhere
[xonotic/darkplaces.git] / cmd.c
diff --git a/cmd.c b/cmd.c
index 18ac78fe5bb7d851756ca2dd69b5b9f527572a5c..ce200ea2de3ad16414b041fe1a4b5978fcf3493b 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -528,12 +528,18 @@ static void Cmd_TokenizeString (const char *text)
        while (1)
        {
                // skip whitespace up to a /n
-               while (*text && *text <= ' ' && *text != '\n')
+               while (*text && *text <= ' ' && *text != '\r' && *text != '\n')
                        text++;
 
-               if (*text == '\n')
+               // line endings:
+               // UNIX: \n
+               // Mac: \r
+               // Windows: \r\n
+               if (*text == '\n' || *text == '\r')
                {
                        // a newline seperates commands in the buffer
+                       if (*text == '\r' && text[1] == '\n')
+                               text++;
                        text++;
                        break;
                }