Permalink
Browse files

Fix command line variables not being set correctly

+seta, +sets, and +setu were ignored because Com_AddStartupCommands
thought Com_StartupVariable handled it.

+set didn't allow value to be multiple tokens which due to Unix shell
unintuitively removing quotes causes the variable to only be set to
the first token. This could be worked around by escaping quotes

    ioq3ded +set g_motd \"hello world\"

but it doesn't match behavior of other start up commands (which now
includes seta, sets, and setu) that use all tokens.
  • Loading branch information...
zturtleman committed Feb 22, 2017
1 parent da747fc commit 313064baa4869888015471a6d827bb015dab9b46
Showing with 3 additions and 3 deletions.
  1. +3 −3 code/qcommon/common.c
View
@@ -491,9 +491,9 @@ void Com_StartupVariable( const char *match ) {
if(!match || !strcmp(s, match))
{
if(Cvar_Flags(s) == CVAR_NONEXISTENT)
- Cvar_Get(s, Cmd_Argv(2), CVAR_USER_CREATED);
+ Cvar_Get(s, Cmd_ArgsFrom(2), CVAR_USER_CREATED);
else
- Cvar_Set2(s, Cmd_Argv(2), qfalse);
+ Cvar_Set2(s, Cmd_ArgsFrom(2), qfalse);
}
}
}
@@ -522,7 +522,7 @@ qboolean Com_AddStartupCommands( void ) {
}
// set commands already added with Com_StartupVariable
- if ( !Q_stricmpn( com_consoleLines[i], "set", 3 ) ) {
+ if ( !Q_stricmpn( com_consoleLines[i], "set ", 4 ) ) {
continue;
}

0 comments on commit 313064b

Please sign in to comment.