Browse Source

engine: restore command escaping

pull/2/head
Alibek Omarov 3 years ago committed by a1batross
parent
commit
508eb7ab5f
  1. 36
      engine/common/cmd.c
  2. 1
      engine/common/common.h

36
engine/common/cmd.c

@ -983,7 +983,7 @@ static void Cmd_ExecuteStringWithPrivilegeCheck( const char *text, qboolean isPr @@ -983,7 +983,7 @@ static void Cmd_ExecuteStringWithPrivilegeCheck( const char *text, qboolean isPr
cmd_condlevel = 0;
// cvar value substitution
if( cmd_scripting && cmd_scripting->value )
if( CVAR_TO_BOOL( cmd_scripting ))
{
while( *text )
{
@ -1330,9 +1330,43 @@ void Cmd_Null_f( void ) @@ -1330,9 +1330,43 @@ void Cmd_Null_f( void )
{
}
/*
==========
Cmd_Escape
inserts escape sequences
==========
*/
void Cmd_Escape( char *newCommand, const char *oldCommand, int len )
{
int c;
int scripting = CVAR_TO_BOOL( cmd_scripting );
while( (c = *oldCommand++) && len > 1 )
{
if( c == '"' )
{
*newCommand++ = '\\';
len--;
}
if( scripting && c == '$')
{
*newCommand++ = '$';
len--;
}
*newCommand++ = c; len--;
}
*newCommand++ = 0;
}
/*
============
Cmd_Init
============
*/
void Cmd_Init( void )

1
engine/common/common.h

@ -503,6 +503,7 @@ qboolean Cmd_GetMovieList( const char *s, char *completedname, int length ); @@ -503,6 +503,7 @@ qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
void Cmd_TokenizeString( const char *text );
void Cmd_ExecuteString( const char *text );
void Cmd_ForwardToServer( void );
void Cmd_Escape( char *newCommand, const char *oldCommand, int len );
//
// zone.c

Loading…
Cancel
Save