aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoricculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-09-15 06:12:42 +0000
committericculus <icculus@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-09-15 06:12:42 +0000
commit48f8ebbe2e403e9e28394be162476886e42307ce (patch)
tree27fa56045205011dcf1ead9fac2d66d7bd26be89
parent413643decfe5394d385ba16d1da0f134ecda9fbc (diff)
downloadioquake3-aero-48f8ebbe2e403e9e28394be162476886e42307ce.tar.gz
ioquake3-aero-48f8ebbe2e403e9e28394be162476886e42307ce.zip
Quote commandline args with spaces when building the string for Com_Init().
git-svn-id: svn://svn.icculus.org/quake3/trunk@1620 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/sys/sys_main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c
index eb49326..ff58187 100644
--- a/code/sys/sys_main.c
+++ b/code/sys/sys_main.c
@@ -542,7 +542,15 @@ int main( int argc, char **argv )
// 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 ), " " );
}