[quake3-commits] r1620 - trunk/code/sys

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Sep 15 02:12:42 EDT 2009


Author: icculus
Date: 2009-09-15 02:12:42 -0400 (Tue, 15 Sep 2009)
New Revision: 1620

Modified:
   trunk/code/sys/sys_main.c
Log:
Quote commandline args with spaces when building the string for Com_Init().


Modified: trunk/code/sys/sys_main.c
===================================================================
--- trunk/code/sys/sys_main.c	2009-09-15 05:57:14 UTC (rev 1619)
+++ trunk/code/sys/sys_main.c	2009-09-15 06:12:42 UTC (rev 1620)
@@ -542,7 +542,15 @@
 	// Concatenate the command line for passing to Com_Init
 	for( i = 1; i < argc; i++ )
 	{
+		const qboolean containsSpaces = strchr(argv[i], ' ') != NULL;
+		if (containsSpaces)
+			Q_strcat( commandLine, sizeof( commandLine ), "\"" );
+
 		Q_strcat( commandLine, sizeof( commandLine ), argv[ i ] );
+
+		if (containsSpaces)
+			Q_strcat( commandLine, sizeof( commandLine ), "\"" );
+
 		Q_strcat( commandLine, sizeof( commandLine ), " " );
 	}
 



More information about the quake3-commits mailing list