Browse Source

engine: common: fix cmdlist and cvarlist to match the beginning of command or cvar

pull/2/head
Alibek Omarov 2 years ago
parent
commit
ca2a6635b6
  1. 12
      engine/common/cmd.c
  2. 6
      engine/common/cvar.c

12
engine/common/cmd.c

@ -1171,17 +1171,21 @@ void Cmd_List_f( void ) @@ -1171,17 +1171,21 @@ void Cmd_List_f( void )
{
cmd_t *cmd;
int i = 0;
const char *match;
size_t matchlen = 0;
const char *match = NULL;
if( Cmd_Argc() > 1 ) match = Cmd_Argv( 1 );
else match = NULL;
if( Cmd_Argc() > 1 )
{
match = Cmd_Argv( 1 );
matchlen = Q_strlen( match );
}
for( cmd = cmd_functions; cmd; cmd = cmd->next )
{
if( cmd->name[0] == '@' )
continue; // never show system cmds
if( match && !Q_stricmpext( match, cmd->name ))
if( match && !Q_strnicmpext( match, cmd->name, matchlen ))
continue;
Con_Printf( " %-*s ^3%s^7\n", 32, cmd->name, cmd->desc );

6
engine/common/cvar.c

@ -934,16 +934,20 @@ void Cvar_List_f( void ) @@ -934,16 +934,20 @@ void Cvar_List_f( void )
const char *match = NULL;
char *value;
int count = 0;
size_t matchlen = 0;
if( Cmd_Argc() > 1 )
{
match = Cmd_Argv( 1 );
matchlen = Q_strlen( match );
}
for( var = cvar_vars; var; var = var->next )
{
if( var->name[0] == '@' )
continue; // never shows system cvars
if( match && !Q_stricmpext( match, var->name ))
if( match && !Q_strnicmpext( match, var->name, matchlen ))
continue;
if( Q_colorstr( var->string ))

Loading…
Cancel
Save