mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: common: fix cmdlist and cvarlist to match the beginning of command or cvar
This commit is contained in:
parent
7f1bb9b4a6
commit
ca2a6635b6
@ -1171,17 +1171,21 @@ void Cmd_List_f( void )
|
|||||||
{
|
{
|
||||||
cmd_t *cmd;
|
cmd_t *cmd;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const char *match;
|
size_t matchlen = 0;
|
||||||
|
const char *match = NULL;
|
||||||
|
|
||||||
if( Cmd_Argc() > 1 ) match = Cmd_Argv( 1 );
|
if( Cmd_Argc() > 1 )
|
||||||
else match = NULL;
|
{
|
||||||
|
match = Cmd_Argv( 1 );
|
||||||
|
matchlen = Q_strlen( match );
|
||||||
|
}
|
||||||
|
|
||||||
for( cmd = cmd_functions; cmd; cmd = cmd->next )
|
for( cmd = cmd_functions; cmd; cmd = cmd->next )
|
||||||
{
|
{
|
||||||
if( cmd->name[0] == '@' )
|
if( cmd->name[0] == '@' )
|
||||||
continue; // never show system cmds
|
continue; // never show system cmds
|
||||||
|
|
||||||
if( match && !Q_stricmpext( match, cmd->name ))
|
if( match && !Q_strnicmpext( match, cmd->name, matchlen ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Con_Printf( " %-*s ^3%s^7\n", 32, cmd->name, cmd->desc );
|
Con_Printf( " %-*s ^3%s^7\n", 32, cmd->name, cmd->desc );
|
||||||
|
@ -934,16 +934,20 @@ void Cvar_List_f( void )
|
|||||||
const char *match = NULL;
|
const char *match = NULL;
|
||||||
char *value;
|
char *value;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
size_t matchlen = 0;
|
||||||
|
|
||||||
if( Cmd_Argc() > 1 )
|
if( Cmd_Argc() > 1 )
|
||||||
|
{
|
||||||
match = Cmd_Argv( 1 );
|
match = Cmd_Argv( 1 );
|
||||||
|
matchlen = Q_strlen( match );
|
||||||
|
}
|
||||||
|
|
||||||
for( var = cvar_vars; var; var = var->next )
|
for( var = cvar_vars; var; var = var->next )
|
||||||
{
|
{
|
||||||
if( var->name[0] == '@' )
|
if( var->name[0] == '@' )
|
||||||
continue; // never shows system cvars
|
continue; // never shows system cvars
|
||||||
|
|
||||||
if( match && !Q_stricmpext( match, var->name ))
|
if( match && !Q_strnicmpext( match, var->name, matchlen ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( Q_colorstr( var->string ))
|
if( Q_colorstr( var->string ))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user