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.
This commit is contained in:
Zack Middleton 2017-02-22 14:40:40 -06:00
parent da747fc291
commit 313064baa4

View file

@ -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;
}